Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi


OleDbConnection con = new OleDbConnection("provider =Microsoft.JET.OLEDB.4.0;data source=D:\\connect\\customer.mdb");
                con.Open();
               OleDbCommand cmd = new OleDbCommand("Insert into add values('"+nametxt.Text+"','"+emailtxt.Text+""+comboBox3.SelectedItem.ToString()+"','"+religiontxt.Text +"','"+dobtxt.Text+"','"+languagetxt.Text +"','"+mobiltxt.Text+"','"+statetxt.SelectedItem.ToString()+"','"+citytxt.SelectedItem.ToString()+"','"+areatxt.Text+"','"+strtxt.Text +"','"+htxt.Text +"','"+pintxt.Text +"','"+landtxt.Text +"','"+snametxt.Text +"','"+dobtxt1.Text +"','"+wedtxt.Text +"','"+cnametxt.Text +"','"+dobtxt2.Text +"','"+cnametxt1.Text +"','"+dobtxt3.Text +"')", con);
               // OleDbCommand cmd = new OleDbCommand("Insert  into add values('s','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a')", con);
               cmd.ExecuteNonQuery();
                MessageBox.Show("Added " + nametxt.Text + " as your customer", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                con.Close();



what is the error in the connection it was showing as
"Object reference not set to an instance of an object." the access2003 database contains 20 fields

for i am wasting nearly one hour fo rthis simple thing but i dont know what is he reason

please help me
Posted
Updated 11-Aug-10 2:51am
v5
Comments
koool.kabeer 11-Aug-10 7:09am    
post complete error.....
Dalek Dave 11-Aug-10 7:22am    
More info required.
(And it looks bloody awful).

1 solution

OleDbCommand cmd = new OleDbCommand("Insert into add values ('siva','sivakumar',[MISSING QUOTE HERE] sivakumarsg','s','as','as','a','d','f','g','h','j','k','l','ssd','s','sd','sd','sd','sde','s','d','d','sdf','sf','sdf','sf','sdsf')", con);

:)
 
Share this answer
 
Comments
Per Söderlund 11-Aug-10 7:42am    
Reason for my vote of 5
Yup
[no name] 13-Aug-10 4:33am    
Reason for my vote of 5
its perfect answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900