inserting data
-
hello, I am trying to insert data into a database.My code gives no error. But the values are not inserted into database. Please help...can anyone send a sample code
-
hello, I am trying to insert data into a database.My code gives no error. But the values are not inserted into database. Please help...can anyone send a sample code
Could u show ur code? Is there any error in database connection?
-
hello, I am trying to insert data into a database.My code gives no error. But the values are not inserted into database. Please help...can anyone send a sample code
Your question is not explaining anything about what you did. Have you put breakpoints and stepped into the code ?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
hello, I am trying to insert data into a database.My code gives no error. But the values are not inserted into database. Please help...can anyone send a sample code
are you trying to insert data from textBox or other controls? are you using Oracle or SQl ?...plz. give some details....
-
are you trying to insert data from textBox or other controls? are you using Oracle or SQl ?...plz. give some details....
-
Your question is not explaining anything about what you did. Have you put breakpoints and stepped into the code ?
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
using System.Data.SqlClient; using System.Data.OleDb; code for connecting to SQL database:- try { SqlConnection mc = new SqlConnection(Persist Security Info=False;User ID=sa;Initial Catalog=DataBase_Name;Data Source= SQL_Server_Name"); SqlDataAdapter da =new SqlDataAdapter("Select * from Table_name", mc); DataSet ds =new DataSet(); da.Fill(ds,"Table_name"); MessageBox.Show("Connection Successfull"); } catch(Exception ex) {MessageBox.Show(ex.Message); } code for inserting data from textBox:- try{ SqlCommand insertCmd=new SqlCommand("insert into Table_Name(Column_Name)values(@Variable_name)",Connection_Name); insertCmd.Parameters.Add("@Variable_Name",SqlDbType.Nchar,10); insertCmd.Parameters["@Variable_Name"].Value=textBox1.Text; insertCmd.ExecuteNonQuery(); MessageBox.Show("Records inserted successfully"); } catch(Exception ex) {MessageBox.Show(ex.Message);}