MySQLString = "INSERT INTO Bank_Details(Bank_Code,Bank_Name,Acc_No)" +
"VALUES('"+ txtBankCode.Text +"','"+ txtBankName.Text +"','"+ txtAccNo.Text +"')";
SqlConnection MySqlConn = new SqlConnection(MyConnectionString);
SqlCommand MySqlComm = new SqlCommand(MySQLString, MySqlConn);
// MySqlConn and MySqlComm refer to variable and not the DBMS
MySqlComm.Connection.Open();
MySqlComm.ExecuteNonQuery();
MySqlComm.Connection.Close();
mwith wrote:
And can anybody explain me, what are the good/bad coding practices with this?
When working with DB try your best to keep it simple. Also, check the SQL statement if Bank_Code and Acc_No are 'int' data types then you need to convert the textboxes from string to int. i.e. Convert.ToInt32(txtBankCode.Text) Good Luck, Jason -- modified at 12:01 Thursday 11th January, 2007
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software. [^]