ورود

View Full Version : انتقال مجموع يك ستون كه توسط query ايجاد شده به textbox



imani1983
سه شنبه 22 تیر 1389, 20:49 عصر
با سلام
مي خوام انتقال مجموع يك ستون به Textbox كه توسط query ايجاد شده ولي نتونستم به Textbox انتقال دهم

private void button8_Click(object sender, EventArgs e)
{
SqlDataAdapter da1 = new SqlDataAdapter("", con);
SqlCommand cmd1 = new SqlCommand("", con);
DataSet ds1 = new DataSet();
DataTable dtb1 = new DataTable();
string sqlselect = "select sum(sum_value)as sumer from kala where CodeFactor="+"'"+textBox5.Text+"'";
cmd1.Connection.Open();
cmd1.CommandText = sqlselect;
cmd1.Connection = con;
con.Close();{

:بوس::بوس:

single_2008boy
چهارشنبه 23 تیر 1389, 20:47 عصر
public string Exact(string text)
{
SqlConnection con = new SqlConnection(cs);
con.Open();
SqlCommand cmd = new SqlCommand();
SqlCommand mycommand = new SqlCommand(text,con);
try
{
mycommand.ExecuteNonQuery();
}

catch (Exception ex)
{
return ex.Message;
}
con.Close();
return "succeed!";
}
رشته را به این تابع بفرست