Saturday, March 10, 2018

insert C# SQL

 string strSQL1;
            strSQL1 = "   insert into [tblcontrol_Comt] ( [SLNO],[Status],[Reason]) select " + t1 + ",'" + DropDownList4.SelectedItem + "','" + TB_Comment.Text + "'";
            strSQL = strSQL + strSQL1;

            //Response.Write(strSQL);
            //Response.End();


            SqlCommand cmd = new SqlCommand(strSQL, myConnection);
            cmd.CommandTimeout = 30000;
            cmd.CommandType = CommandType.Text;
            myConnection.Open();
            cmd.ExecuteNonQuery();
            myConnection.Close();

No comments: