Click here to Skip to main content
13,549,306 members
Rate this:
Please Sign up or sign in to vote.
See more:
Can anyone help me here please...

private void button3_Click(object sender, EventArgs e)
            SqlCeConnection con = new SqlCeConnection();
            con = utility.createconnection("Database1");            
            Database1DataSet1 dsCustomer = new Database1DataSet1();
            SqlCeCommand Query = new SqlCeCommand("INSERT INTO shop_details " +
                                "(shop_name,Name,Address,shop_id) " +
                                "VALUES (@shop_name,@Name,@Address,@shop_id)", con);

            Query.Parameters.AddWithValue("@shop_name", textBox8.Text);
            Query.Parameters.AddWithValue("@Name", textBox1.Text);            
            Query.Parameters.AddWithValue("@Address", textBox2.Text);
            Query.Parameters.AddWithValue("@shop_id", textBox7.Text);
            SqlCeDataAdapter sqlceda = new SqlCeDataAdapter(Query);
            sqlceda.Fill(dsCustomer, "shop_details");
Posted 19-Jan-13 21:25pm
OriginalGriff 20-Jan-13 3:42am
Form just that data, no we can't - do you get any errors? How can you tell no data is inserted? Have you checked that the button click event is getting fired?
Member-4464669 20-Jan-13 4:06am
There was no errors found. When I clicking the button no data inserted into the table. When I debug the code text box values are getting but finally there was no rows inserted into the table.
OriginalGriff 20-Jan-13 4:51am
"There was no errors found"
Compilation or runtime - did you step through in the debugger and check your code and variables at each step?
"no rows inserted into the table"
How do you know? Where did you look for your records, and how? Did you use SSMS? Or your own code?
Member-4464669 20-Jan-13 5:29am
Compilation - No error
When debugging via runtime at eachstep - all the values are populating in each step.
When I querying into the Database1.sdf (Database) No rows returned.
OriginalGriff 20-Jan-13 5:50am
What query did you use?
BTW: If you use the "Reply" feature instead of "question or comment" this might go quicker - I get an email then, instead of having to remember to check back here and see if there is new info.
Member-4464669 20-Jan-13 6:29am
select * from shop_details;
OriginalGriff 20-Jan-13 6:52am
Does your createconnection method use a transaction?
Can you show the code for using the select? (Remember, I can't see your screen or access your HDD so you have to "spoon-feed" me to an extent!)
digimanus 21-Jan-13 7:12am
why use a DataAdepter to fill when needing ExecuteNonQuery for an Insert statement? Are all textboxes filled or is NULL the value of any of these parameters.
Faisalabadians 21-Jan-13 9:32am
is con's connection state is opened?

1 solution

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180515.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100