473,976 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error:System.Da ta.NoNullAllowe dException on non-null column

Getting error on insert when I try to add a new row to a dataset; used Visual
Studio IDE to generate stored procedures, data adapter, and dataset. Table
on SQL server has a column marked non-null. The code that I wrote is
included below.
static void Main()
{
Application.Run (new Form1());
}

private void btnSearch_Click (object sender, System.EventArg s e)
{
sqlDataAdapter1 .SelectCommand. Parameters["@Param2"].Value =
txtBoxSPSearch. Text;
dsStaffPhysicia ns1.Clear();
sqlDataAdapter1 .Fill(dsStaffPh ysicians1);
}

private void btnReset_Click( object sender, System.EventArg s e)
{
this.dsStaffPhy sicians1.Clear( );
ClearStaffPhysi cian();
}
private void SetupStaffPhysi cian()
{ //Initialize Staff Physician Page
panel1.Visible = true;
this.cBoxSPLice nseState.DataBi ndings.Add(new
System.Windows. Forms.Binding(" SelectedIndex", this.dsStaffPhy sicians1,
"tblStaffPhysic ians.docLicense State"));
}

private void ClearStaffPhysi cian()
{ //Clears textboxes and dropdowns
txtBoxSPFirstNa me.Text = "";
txtBoxSPMiddleN ame.Text = "";
txtBoxSPLastNam e.Text = "";
txtBoxSPUpin.Te xt = "";
txtBoxSPLicense Number.Text = "";
txtBoxSPSearch. Text = "";
cBoxSPLicenseSt ate.SelectedInd ex = 0;
}

private void menuItem2_Click (object sender, System.EventArg s e)
{ //Main menu -- Staff Physicians
SetupStaffPhysi cian();
menuItem2.Enabl ed = false;
}

private void btnUpdate_Click (object sender, System.EventArg s e)
{
this.BindingCon text[dsStaffPhysicia ns1,
"tblStaffPhysic ians"].EndCurrentEdit ();
sqlDataAdapter1 .Update(dsStaff Physicians1);
sqlDataAdapter1 .Fill(dsStaffPh ysicians1);
}

private void btnInsert_Click (object sender, System.EventArg s e)
{
//Generates Error:System.Da ta.NoNullAllowe dException
//Column 'docLName' does not allow nulls.
this.BindingCon text[dsStaffPhysicia ns1, "tblStaffPhysic ians"].AddNew();
ClearStaffPhysi cian();
this.btnInsert. Text = "Inserted";
}

private void menuItem3_Click (object sender, System.EventArg s e)
{
Application.Exi t();
}

private void btnCommit_Click (object sender, System.EventArg s e)
{
//Need to do something here
}
}
}

Nov 17 '05 #1
0 1447

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3570
by: Vincento Harris | last post by:
Anyone knows what would cause this?When Enterprise Manager is used to open a table Runtime error data provider or other service provided an efail status
0
1844
by: Martyn Wynne | last post by:
Hi, Can anyone please tell me if there is any reason why when i am streaming from a webrequest (decompressing on route) to a file on the hard drive, i would be getting an exception of Filestream error System.StackOverflowException every time the file gets to 8580Kbs. Code is basically a modified Microsoft example, it errors on the line Dim ar As IAsyncResult = _
0
1261
by: Rich | last post by:
I've used VS2003 Wizard to create sqlDataAdapter, stored procedures, and dataset on my application. I can search and update fine but Insert has error unless I perform a search or update prior to my insert. Any ideas on how to work around this without rewriting the database? Code Snippet ===================================================== static void Main() { Application.Run(new Form1());
5
1611
by: Patrick.O.Ige | last post by:
What could cause the error:- System.NullReferenceException: Object reference not set to an instance of an object. Any ideas?
2
10935
by: Simon Harris | last post by:
I have created a web service, which when I call in my browser presents the text form etc. When I click the button, I get this error: System.ArgumentException: Cannot convert to System.Int32. Parameter name: type ---> System.FormatException: Input string was not in a correct format. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
0
1249
by: Etienne | last post by:
I'm using DotNetNuke 3.1 and it works well. I try to use Ajax with it. But if I add the Ajax specification in web.config : <add verb="GET,POST" path="vbwrapper/*.ashx" type="Ajax.PageHandlerFactory, Ajax" /> I receive the error : System.Security.SecurityException: Request for the permission of type System.Security.Permissions.ReflectionPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. If...
3
5278
by: Dan | last post by:
Hi, I'm learning asp.net 2.0 and i get this error: "Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource" My code: Dim a As GridView Dim oConnection As OleDbConnection oConnection = New OleDbConnection()
3
2047
by: vishwaskothari | last post by:
What is wrong in the following Statement? Dim mydate As Date Format(mydate, "m/d/yy") rs.Open "SELECT * from accounts where date='" & mydate & "';", con, adOpenStatic, adLockOptimistic
0
1583
by: amuven | last post by:
Hi All, I have created xls using pyExcelerator. when i tried to open that xls sheet i'm getting this error message "File error: data may have been lost " , Please some one help me how to rectify the above. my code is : def fnwrite(Dictionary): font0 = Font() font0.name = 'Verdana' font0.bold = True font0.colour_index = 2
10
10527
by: muby | last post by:
Hi Everybody the compiler throws an error when it runs this function in my code, I couldn't figure out what is wrong with my code, please assist me, thanks :). void SMAC::IncreaseCW() { init rI=2; DATA_CW=DATA_CW*rI; double cw = (Random::random() % DATA_CW) * slotTime_sec_; mhCS_.sched(CLKTICK2SEC(difs_) + cw);
0
11811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10903
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8454
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7601
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3756
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.