Including SQL Server Allow Nulls Fields In Updateable Controls
Jun 13, 2006
When I include a field from my SQL Server database, which has it's Allow Nulls value checked, in the data source of any type of control with it's Enable Editing property check, I then can not edit the record! If I remove the Allow Nulls field I can then edit it! What am I missing here?
Why is it that when I include a column from my SQL Server database table, which has it's Allow Nulls checked, in the data source of a control that the record becomes not update-able? How do I get around this?
I have a table here. I want find a way of getting the latest date, when the code is the same. If the Declined date is null. Then I still want the latest date. E.g. ID 3.
If the declined date is filled in. Then I want to get the row, when the Datein column value is greater then the declined date only.
I tried grouping it by max date, but i got an error message when trying this out. Against the code
WHERE MAX(Datein) > Declined
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference. What do I need to do to get both my outputs working?
I currently have 5 fields in the same SQL Server table, 4 of which pull Stock Levels from other tables and the 5th is a Total Stock field which is to add the 4 previous fields.
The problem is that some of the first 4 fields contain nulls as well as figures and when the Total Stock trys to add these together the outcome is Null, which is incorrect.
E.G
COL 1 COL 2 COL 3 COL 4 TOTALSTOCK
2 NULL 0 1 NULL
I have tried to change it to a NOT NULL Column but won't let me.
Is there a way to do an update to change NULL's to 0?
Hi, I have fields in my table which allow nulls. Is it efficient to not insert anything (the field automatically shows up as null in this case) and leave or store some value into it. The field is a smallint field?
I have a select statement which has to convert some date fields stored as varchar based on critera of adding numbers to the date. What I have below will return data show below but gives me an error message when it encounters any data with null in the field. Is there something wrong in my conversion? Thanks
Hi, I am porting a massive VB6 project to ASP.net 2005. Most of the code is fine, however because the original developers used lots of data controls and my own time restrictions I thought to replicate the functionality by using Sqldatasource controls instead. These data controls are bound to DBtruegrids. The project has has lots of code like... AdodcOrders.Recordset.RecordCount > 0 or If AdodcOrders.Recordset.EOF or AdodcOrders.Recordset.MoveNext() or AdodcDetail.Recordset!FieldName The problem is the sqldatasource control doesn't have a recordset/dataset property which I can access and manipulate, or does it? What should I do to get round these? The project has thousands of lines like this in so its not feasible to rewrite it (although if I could I would!). Any suggestions please gratefully appreciated. many thanks mike
We have many users with a mobile application running SQL Mobile and using merge replication to get data back to the SQL 2008 R2 database. This has worked very well for many years.
We now have a requirement to have this data reported on using Reporting Services. This is where it gets messy.
Due to a limitation of Report Builder(see this blog) we cannot provide access to users for creating their own reports. The report database is remote from the host and there is no VPN.
We hit upon the idea of creating an almost identical publication but the articles as read-only. It was only after this was done that we started having trouble with our existing mobile users.
It seems that a published article is EITHER Bi-directional OR Read-only even if they are in separate publications.
I then thought of using Transactional Publication but this too is blocked on creation with "automatic identity range support is useful only for publications that allow updating subscribers"(Merge and Transactional publication are mutually exclusive)
So in the final analysis is there a way for me to have merge replication AND some other form of SQL replication/data transfer that can have the same data transmitted readonly to a separate full SQL server database?
When i do a select on my emplee table for rows with null idCompany i dont get any records
I then try to modify the table to not allow a null idCompany and i get this error message:
'Employee (aMgmt)' table - Unable to modify table. Cannot insert the value NULL into column 'idCompany', table 'D2.aMgmt.Tmp_Employee'; column does not allow nulls. INSERT fails. The statement has been terminated.
Hi, i wrote a simple program to access a SQL Server 2005 DB and i use the following connection string: <connectionStrings> <add name="Alunos" connectionString="Data Source=.;Initial Catalog=ALUNOS;integrated security=true"/> <add name="Escola" connectionString="Data Source=.SQLEXPRESS;Initial Catalog=Escola;integrated security=true"/> </connectionStrings> It all works fine.Then i try to create a SQLDataSource object graphically and configure it. when i choosethe instance and DBi choose Test Connection and it gives the 'Named Pipes Provider , error 40'. I think i solves this problem because i googled thisand found a lot of info and i did all that.But the problem remains.Could it be the a security issue? with the user i´m using to access the DB?Some help on this would be very appreciated.ThanksSP
Here's my situation: I need to move several application db's to a new server. The current server is SQL 7.0 SP2, the new server will be SQL 7.0 SP3.
In order to avoid having the problems of mismatched logins and db user definitions, I'd like to restore the current master over the master that's created at install on the new server.
I was doing some testing of this by trying to restore the 7.0 SP2 master onto a SQL 7.0 DE edition and had some problems. (Obviously, this is not the exact scenario that I need to take place -- I want to restore standard edition to standard edition.)
Is restoring the master db from different service packs under 7.0 going to pose a problem? Is restoring the master db the best way to get around the logins issue when moving db's?
when my ASP.NET 2.0 web site working against MS SQL Server 2000,I Usually have a connection string to the DB, I create a connection, and start working on the data. While reading about the MemberShip provider of ASP.NET 2.0 (Login control, Forgot password, etc.),I read that it's possible to save the MDF file of the membership controls, within the APP_DATA folder. But how can it be ? the MDF file must be at the server folder,How can I access this MDF file ? with which connection string ?How does MS SQL Server 2000 syncronize against this MDF file within my APP_DATA folder ? And by the way, if my hosting company allow me to use 1 db schema of the MS SQL Server 2000 server,Does this method (saving the MDF file within thr APP_DATA folder) allow me to use multiple schemas ? Thanks.
is there an elegant way to use one equals sign in a where clause that returns true when both arguments are null, and returns true when neither is null but both are equal and returns false when only one is null?
I'm working on an MSI-based install that installs a suite of applications. One of the applications requires SQL Server 2005 Express to be installed or already on the machine, but if the user doesn't want that app installed, I don't want to have to bother with the SQL Server issue; however, if that app is to be installed and SQL Server is not already installed, I want to be able to have it installed automatically during our install in order to make it easier for our end users. The obvious answer to this is to launch the SQL Server Express install as a nested MSI install at the appropriate point in our install. Since the SQL Server install is so complex, I was wondering if this would work if I were to launch the SQL Server install's setup.exe; or do I have to launch one of its dozen MSI files? If it's the latter, which one should my install launch? (Or is the SQL Server Express install simply too complex to be included in my install in this way? My plan is to have the SQL Server install sitting somewhere on our install CD - we've already obtained a redistribution licence - and have our install access it from there.) And will SQL Server Express appear as a separate entry in the Add/Remove Programs applet if it's installed this way? (I'd like to be able to leave SQL Server in place when uninstalling our application suite - or even just the one app that needs it - and allow SQL Server to be uninstalled separately if the user wishes.)
Hello, we have some tables and views that are not assigned to the standard schema of dbo.Whenever I try to use a design time control and/or SQLDataSource connection control, it does not like objects other than those using the dbo. schema.Any ideas on how to resolve this issue?For example, her are a couple of views:dbo.vwCustomersdbo.vwCustomerDetailsord.vwOrdersord.vwOrderDetailsthe views with dbo.* I have no problem with.the views with ord. it tells me the view(s) do not exist.Thanks in advance!
hello, I have developed a website using asp.net 2.0 and sql server 2005 express edition. I have used the built-in membership, roles and login controls in my website. now i need to change the database server. i have to use sql server 2000 instead. as asp.net 2.0 uses the ASPNETDB.mdf for member,roles and login controls, so how can i do it? i can easily export the database from 2005 to 2000 but how my application controls will know where to look at for those data. I am clueless. please help me. thanks in advance.
would like to deinstall sql components and sql express. which components can be deinstalled when just using sql server. cannot find sql server express from the add remove programs.
How can I create a Table whose one field will be 'tableid INT IDENTITY(1,1)' and other fields will be the fields from the table "ashu". can this be possible in SQL Server without explicitly writing the"ashu" table's fields name.
Hello all, I am having problems running a stored proc from an aspx.cs file. Basically I want to extract data from webForm controls and create a new record in a DB table. I have watched the "Getting Started" videos on thi site, and the only difference between my code and the code of the demonstrator is the connection string. My conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString;Demonstrator conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings("ProjectTblConnString");When I debug with the string as shown by the demonstrator the error list reports that ConnectionStrings is a property and I am trying to use it as a mothod, which is fair enough, but I am just confused as how it worked for the demonstrator and not myself. When I debug with the code I used above I get no error, but nothing is inserted in the DB.Also, it looks as if the only class in my aspx.cs file that is actually being executed is PageLoad() - the remainder of the code seems to be ignored. Below is the entired aspx.cs file:- 1 using System; 2 using System.Data; 3 using System.Configuration; 4 using System.Collections; 5 using System.Web; 6 using System.Web.Security; 7 using System.Web.UI; 8 using System.Web.UI.WebControls; 9 using System.Web.UI.WebControls.WebParts; 10 using System.Web.UI.HtmlControls; 11 12 public partial class CreateProject : System.Web.UI.Page 13 { 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 17 if (User.Identity.IsAuthenticated == false) 18 { 19 Server.Transfer("Default.aspx"); 20 } 21 22 if (chkbox_startDate.Checked == true) 23 { 24 txtbox_startDate.ReadOnly = true; 25 txtbox_startDate.Text = (System.DateTime.Now.ToString()); 26 } 27 28 } 29 30 protected void btn_create_Click(object sender, EventArgs e) 31 { 32 //connection string for connecting to SQL Server DB 33 SqlDataSource dataSrc = new SqlDataSource(); 34 dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString; 35 36 37 //insert data in table using the CreateNewProject stored proc in the DB 38 dataSrc.InsertCommandType = SqlDataSourceCommandType.StoredProcedure; 39 dataSrc.InsertCommand = "CreateNewProject"; 40 dataSrc.InsertParameters.Add("Project_Title", txtbox_title.ToString() ); 41 dataSrc.InsertParameters.Add("Description", txtbox_desc.ToString() ); 42 dataSrc.InsertParameters.Add("Start_Date", txtbox_startDate.ToString() ); 43 dataSrc.InsertParameters.Add("Primary_Dev_Lang", list_devLang.ToString() ); 44 dataSrc.InsertParameters.Add("Dev_Environment", list_devEnv.ToString() ); 45 dataSrc.InsertParameters.Add("No_Junior_Devs", txtbox_juniorDevs.ToString() ); 46 dataSrc.InsertParameters.Add("No_Senior_Devs", txtbox_seniorDevs.ToString() ); 47 48 int rowsAffected = 0; 49 try 50 { 51 rowsAffected = dataSrc.Insert(); 52 } 53 catch (Exception ex) 54 { 55 Server.Transfer(Error.aspx); 56 } 57 finally 58 { 59 dataSrc = null; 60 } 61 62 if (rowsAffected != 1) 63 { 64 label_confirm.Text = "Error, Contact system admin"; 65 } 66 else 67 { 68 label_confirm.Text = "Success"; 69 } 70 71 }//end btn_create 72 73 //if cancel is clicked set all values back to default 74 protected void btn_cancel_Click(object sender, EventArgs e) 75 { 76 txtbox_title.Text = ""; 77 txtbox_desc.Text = ""; 78 txtbox_startDate.Text = ""; 79 txtbox_seniorDevs.Text = ""; 80 txtbox_juniorDevs.Text = ""; 81 list_devEnv.SelectedIndex = 0; 82 list_devLang.SelectedIndex = 0; 83 chkbox_startDate.Checked = true; 84 label_confirm.Text = ""; 85 } 86 87 //if checked the current dateTime is inserted into txtbox 88 protected void chkbox_startDate_CheckedChanged(object sender, EventArgs e) 89 { 90 if (chkbox_startDate.Checked == true) 91 { 92 txtbox_startDate.ReadOnly = true; 93 txtbox_startDate.Text = (System.DateTime.Now.ToString()); 94 } 95 else 96 { 97 txtbox_startDate.ReadOnly = false; 98 txtbox_startDate.Text = ""; 99 } 100 }//end chkox 101 102 103 }//end class
Any help anyome can give is greatly appreciated. This is part of my Final Year College Dissertation which is due in 3wks !!!! Sláinte á chaire, Seán
All, My ISP does not allow me to remotely connect to my hosted SQL Server DB--how can I use SQLDataSource and other data bound controls in development? Here are my specs: IDE: Visual Web Developer Express 2005 Database: MS SQL Server ASP Version: ASP.NET 2.0 The SQL Server is hosted centrally at the ISP; basically I have been given the connection string parameters. My question is this: Do I use two web.config files (one for when I develop locally and one for when I deploy remotely)? If so, how? Will the SQLDataSource control find the connection string defined in web.config on the remote server? I don't want to have to write all of the database code and it would be a big loss of one of the major benefits of using ASP.NET 2.0 if I do. Any help will be greatly appreciated, Leslie
I have two SSIS packages that import from the same flat file into the same SQL 2005 table. I have one flat file connection (to a comma delimited file) and one OLE DB connection (to a SQL 2005 Database). Both packages use these same two Connection Managers. The SQL table allows NULL values for all fields. The flat file has "empty values" (i.e., ,"", ) for certain columns.
The first package uses the Data Flow Task with the "Keep nulls" property of the OLE DB Destination Editor unchecked. The columns in the source and destination are identically named thus the mapping is automatically assigned and is mapped based on ordinal position (which is equivalent to the mapping using Bulk Insert). When this task is executed no null values are inserted into the SQL table for the "empty values" from the flat file. Empty string values are inserted instead of NULL.
The second package uses the Bulk Insert Task with the "KeepNulls" property for the task (shown in the Properties pane when the task in selected in the Control Flow window) set to "False". When the task is executed NULL values are inserted into the SQL table for the "empty values" from the flat file.
So using the Data Flow Task " " (i.e., blank) is inserted. Using the Bulk Insert Task NULL is inserted (i.e., nothing is inserted, the field is skipped, the value for the record is omitted).
I want to have the exact same behavior on my data in the Bulk Insert Task as I do with the Data Flow Task.
Using the Bulk Insert Task, what must I do to have the Empty String values inserted into the SQL table where there is an "empty value" in the flat file? Why & how does this occur automatically in the Data Flow Task?
From a SQL Profile Trace comparison of the two methods I do not see where the syntax of the insert command nor the statements for the preceeding captured steps has dictated this change in the behavior of the inserted "" value for the recordset. Please help me understand what is going on here and how to accomplish this using the Bulk Insert Task.
I am trying to import data from 4 columns in a spreadsheet, the Columns are (Last Name - First Name - ID - Code) and this spreadsheet has around 10k records. I want to add what is in this spreadsheet to the query I have below that uses the EXCEPT operator but I am not sure the best way to go about it.
Using the example I have filtered below for the name "Denise Test", at the end of the day I want everything that is in the spreadsheet to also be excluded from the results.
So before the spreadsheet lets say the 2nd query referencing table C has the following results for Denise Test
Last_Name First_Name ID Code Test Denise 1 5 Test Denise 2 4
After adding the spreadsheet I want it to show this:
Last_Name First_Name ID Code Test Denise 1 5 Test Denise 2 4 Test Denise 3 3
Here is the query as it stands now without the inclusion of the spreadsheet:
SELECT ta.last_name, ta.first_name, tb.ID, tb.code FROM TableA ta INNER JOIN TableB tb
There is a lot of documention concerning data(base) backups, but I could not find information about how to backup a complete SQL Server instance (data + configuration) or the SQL server configuration (= everything, that is not user payload). you always re-configure your system after restoring, especially because you will forget some settings?I found following things necessary to backup configuration:
server-wide: security: login, roles, ... server objectsserver properties (e.g. collation, connection or memory settings; see SSMS "Server - Properties") per database database settings (SSMS - database - properties)scheme
1. Is there anything missing?In case of a severe system crash I would like to be able to recover the system using a full system image of the virtual machine. However I just create these images after significant changes (e.g. Windows service pack).The SQL server should be backuped independently from these system images.
2. Even if I used SQL Server maintenance plan, choose "backup all databases" and additionally backup resources DB manually I think, that some configuration is still missing, right? Where are the security configuration and server properties saved? In my system database there are some tables, but there is very little content inside, so that the data from the views INFORMATION_SCHEMA* and sys.* obviously is not saved there.SQL Server system objects, such as sys.objects, are physically persisted in theResource database, but they logically appear in the sys schema of every database. URL....What does that mean: Are all DB/table schemes, logins, ... saved in resource DB?
3. Does a usual SQL Server full database backup also contain all settings concerning this database (database properties, logins, ...)?
4. Is there at least a way to backup ONLY the configuration (server-wide and database) without data? The only tool I could find is DACPAC, that exports a database's scheme and some other configuration, but e.g. the database properties are not included: By default, the database created during the deployment will have the default settings from the CREATE DATABASE statement. The exception is that the database collation and compatibility level are set to the values from the source database. URL..
Today I have task to move all UDB's including matser,msdb form Windows 2000 server to Windows 2003 Advacned Server with 64bit(8 Hours Down time)
Present Plan
1.Install same Version of SQL Server in Destination Server 2.Take all Databases Backup 2.Move DTS,JOB and Scripts with same location 3.Stop both servers SQL Server's 4.Deattch all Databses and Move to Destination Server 5.Place all Databases(Same Loaction i.e Soruce Server master DB is C:<folders>.. Place in Destination Server C:<folder>..) 6.Start the Databse Servers(Destination) 7.Port the Apllication and Test.
Note:for our project we are using windows users,so that no problem with Orphan users.
Please some body Advice me, or suggest me ..it is ok
I downloaeded "Microsoft SQL Server 2005 Datamining Viewer Controls" feature pack, and tried to run the dataminingviewerclient.exe.
When i view my local time series data mining model, It works well for single series model, but when i load a Microsoft time series model containing multiple data series, an unhandled exception occurs.
I post the error message below:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AnalysisServices.Viewers.TimeSeriesViewer.PreprocessChartArrays(ArrayList rgPredicted, ArrayList rgActual, ArrayList rgDeviations) at Microsoft.AnalysisServices.Viewers.TimeSeriesViewer.LoadChartSpace(MiningModel model) at Microsoft.AnalysisServices.Viewers.TSCheckedListViewCombo.HandleChangesCommitted(Object sender, EventArgs ea) at Microsoft.DataWarehouse.Controls.BaseControlComboBox.OnCommittedChanges(EventArgs e) at Microsoft.DataWarehouse.Controls.BaseControlComboBox.SetSelection(String str, Object obj) at Microsoft.AnalysisServices.Viewers.TimeSeriesViewer.InitializeCurrentlySelectedPage(Object context) at Microsoft.AnalysisServices.Viewers.TreeViewer.viewerTabControl_SelectedIndexChanged(Object sender, EventArgs e) at System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e) at System.Windows.Forms.TabControl.WmSelChange() at System.Windows.Forms.TabControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.
When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.
***** end of error message***
Can someone help to figure out what went wrong? thx.
I am searching for a sp that can generate the entire objects on all my databass in the server. Something like the 'Generate sql scripts' for sql7 but i need it to be capable to run as a scheduled job and automaticly enters in all my databases in the server.
I need to take sql scripts for all my development databases every night. I have something like 80 databases in development on the server.