insert & update problem
-
hi In my project of asp.net and C# i am entering the values in the textboxes and clicking submit button which allows inserting and updation in the same click event i am not using stored procedures for insertion and updation. The problem is that now if i click submit button neither it is getting inserted and updated in the database .Can anyone give me idea what i am suppose to do i dont want to use stored procedure only use a simple sql query. Thanks in advance kal13na13 -- modified at 3:54 Tuesday 13th December, 2005
-
hi In my project of asp.net and C# i am entering the values in the textboxes and clicking submit button which allows inserting and updation in the same click event i am not using stored procedures for insertion and updation. The problem is that now if i click submit button neither it is getting inserted and updated in the database .Can anyone give me idea what i am suppose to do i dont want to use stored procedure only use a simple sql query. Thanks in advance kal13na13 -- modified at 3:54 Tuesday 13th December, 2005
-
here is the code : string strSelect= "Insert into Table1 (Name,Age,Gender) values (?,?,?)"; SqlCommand cmd=new SqlCommand(strSelect,sqlConnection1); sqlConnection1.Open(); cmd.ExecuteNonQuery(); sqlConnection1.Close(); Label1.Text = "Your data has been received!"; //code for the update string updateString = "UPDATE Table1 SET " + "Name='?',Age='?',Gender='?' " + "WHERE Number='?'"; SqlCommand mycmd = new SqlCommand(updateString,sqlConnection1); sqlConnection1.Open(); mycmd.ExecuteNonQuery(); sqlConnection1.Close(); Server.Transfer("Print.aspx"); kal13na13 -- modified at 4:21 Tuesday 13th December, 2005
-
here is the code : string strSelect= "Insert into Table1 (Name,Age,Gender) values (?,?,?)"; SqlCommand cmd=new SqlCommand(strSelect,sqlConnection1); sqlConnection1.Open(); cmd.ExecuteNonQuery(); sqlConnection1.Close(); Label1.Text = "Your data has been received!"; //code for the update string updateString = "UPDATE Table1 SET " + "Name='?',Age='?',Gender='?' " + "WHERE Number='?'"; SqlCommand mycmd = new SqlCommand(updateString,sqlConnection1); sqlConnection1.Open(); mycmd.ExecuteNonQuery(); sqlConnection1.Close(); Server.Transfer("Print.aspx"); kal13na13 -- modified at 4:21 Tuesday 13th December, 2005
-
You haven't added any parameters to the commands, although you specify parameters in the queries. That code should produce an exception. Do you say that it doesn't? --- b { font-weight: normal; }
-
its not rasing any exception ,page is displayed i am able to enter values click submit button no response the same page is there with the data. is there any way i can insert and update data without stored procedures and parameters? thanks kal13na13
-
Are you sure that the code you show is executed at all?
kal13na13 wrote:
is there any way i can insert and update data without stored procedures and parameters?
Yes, you can use a query without parameters. --- b { font-weight: normal; }
yes its getting excuted the page is displayed values are entered the moment submit button is clicked nothing happens Can you tell me how i can achieve updation and insertion queries without use of parameters any good websites. kal13na13 -- modified at 0:06 Wednesday 14th December, 2005
-
yes its getting excuted the page is displayed values are entered the moment submit button is clicked nothing happens Can you tell me how i can achieve updation and insertion queries without use of parameters any good websites. kal13na13 -- modified at 0:06 Wednesday 14th December, 2005
kal13na13 wrote:
yes its getting excuted the page is displayed values are entered the moment submit button is clicked nothing happens
If you would have used any punctuation, that sentence (or sentences?) could have been possible to understand. --- b { font-weight: normal; }