Dadvar
سه شنبه 22 دی 1394, 11:48 صبح
با سلام
کد زیر
sqls.update("insert into Reject values('" + txtdp.Text + "','" + txtmp.Text + "','" + txtlocalrej.Text + "','"
+ txtthic.Text + "','" + txtwidth.Text + "','" + txtlenght.Text + "','" + txtweight.Text + "','" + txtdef.Text + "','"
+ txtdeftype.Text + "','"
+ txtsendplate.Text + "','"
+ txtdaterej.Text + "','"
+ txtdatetimerej.Text + "','"
+ txtshortprog.Text + "','"
+ txtalloy.Text + "','"
+ txtheatno.Text + "','"
+ txtslabid.Text + "','"
+ txtorder.Text + "','"
+ txtdatepro.Text + "')");
با کلاس
public class sqlserver
{
SqlConnection con;
SqlDataAdapter da ;
SqlCommand sc;
public sqlserver(string server,string dbname)
{
con = new SqlConnection("Data Source=" + server + ";Initial Catalog=" + dbname + ";Integrated Security=True");
da = new SqlDataAdapter();
sc = new SqlCommand();
da.SelectCommand = new SqlCommand();
da.SelectCommand.Connection = con;
sc.Connection = con;
}
~sqlserver()
{
con.Close();
}
public DataTable select(string str_q)
{
DataTable temp = new DataTable();
da.SelectCommand.CommandText = str_q;
con.Open();
da.Fill(temp);
con.Close();
return temp;
}
public int update(string str_q)
{
int result;
sc.CommandText = str_q;
con.Open();
result = sc.ExecuteNonQuery();
con.Close();
return result;
}
میخواستم وارد بانک کنم خطای زیر رو میده
result = sc.ExecuteNonQuery();
میخواستم ببینم مشکل چی هست؟
کد زیر
sqls.update("insert into Reject values('" + txtdp.Text + "','" + txtmp.Text + "','" + txtlocalrej.Text + "','"
+ txtthic.Text + "','" + txtwidth.Text + "','" + txtlenght.Text + "','" + txtweight.Text + "','" + txtdef.Text + "','"
+ txtdeftype.Text + "','"
+ txtsendplate.Text + "','"
+ txtdaterej.Text + "','"
+ txtdatetimerej.Text + "','"
+ txtshortprog.Text + "','"
+ txtalloy.Text + "','"
+ txtheatno.Text + "','"
+ txtslabid.Text + "','"
+ txtorder.Text + "','"
+ txtdatepro.Text + "')");
با کلاس
public class sqlserver
{
SqlConnection con;
SqlDataAdapter da ;
SqlCommand sc;
public sqlserver(string server,string dbname)
{
con = new SqlConnection("Data Source=" + server + ";Initial Catalog=" + dbname + ";Integrated Security=True");
da = new SqlDataAdapter();
sc = new SqlCommand();
da.SelectCommand = new SqlCommand();
da.SelectCommand.Connection = con;
sc.Connection = con;
}
~sqlserver()
{
con.Close();
}
public DataTable select(string str_q)
{
DataTable temp = new DataTable();
da.SelectCommand.CommandText = str_q;
con.Open();
da.Fill(temp);
con.Close();
return temp;
}
public int update(string str_q)
{
int result;
sc.CommandText = str_q;
con.Open();
result = sc.ExecuteNonQuery();
con.Close();
return result;
}
میخواستم وارد بانک کنم خطای زیر رو میده
result = sc.ExecuteNonQuery();
میخواستم ببینم مشکل چی هست؟