C#更新值编辑gridview并更新sqlserver 2005 express [英] C# update value editing gridview and update sqlserver 2005 express
问题描述
我有一个列表(表格)在gridview两列c#和sqlserver 2005表示
更新列表与其他人值
(表格)
id value
1 0
2 0
3 0
4 0
5 0
DataTable mydt3; DataSet myds3; SqlDataAdapter myda3; SqlCommand mycmd3;
string connectionString = Connexion.GetConnectionString();
SqlConnection conn = new SqlConnection(connectionString);
mycmd3 = new SqlCommand(SELECT id,value from table,conn);
conn.Open();
myda3 = new SqlDataAdapter(mycmd3);
mycmb3 = new SqlCommandBuilder(myda3);
myds3 = new DataSet();
myda3.Fill(myds3,Stores);
mydt3 = myds3.Tables [商店];
drvMuestras.DataSource = myds3.Tables [商店];
conn.Close(); < br $>
i需要什么,在gridview中更新firt值,
第1行值0,我补充值0,值为5
例如,我需要你更新表格
不使用命令buttom,
只有在网格视图中输入或标签键
myda3.Update(mydt3);
或其他解决方案
谢谢
i have a list(table) in gridview two columns c# and sqlserver 2005 express
for update list with others values
(table)
id value
1 0
2 0
3 0
4 0
5 0
DataTable mydt3;DataSet myds3;SqlDataAdapter myda3;SqlCommand mycmd3;
string connectionString = Connexion.GetConnectionString();
SqlConnection conn = new SqlConnection(connectionString);
mycmd3 = new SqlCommand(" SELECT id,value from table ", conn);
conn.Open();
myda3 = new SqlDataAdapter(mycmd3);
mycmb3 = new SqlCommandBuilder(myda3);
myds3 = new DataSet();
myda3.Fill(myds3, "Stores");
mydt3 = myds3.Tables["Stores"];
drvMuestras.DataSource = myds3.Tables["Stores"];
conn.Close();
i need, what at update firt value in gridview,
row 1 value 0, i replece the value 0 whith value 5
for example, i need you updated the table
not use a command buttom,
only whith key enter or tab in the gridview
myda3.Update(mydt3);
or other solution
thank you
推荐答案
您可以使用文本框创建模板列,在text_change事件中可以放置更新sql查询。
You can create a template column with a textbox and on text_change event you can place the update sql query .
这篇关于C#更新值编辑gridview并更新sqlserver 2005 express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!