datagrid的问题 窗体上有datagrid 和textbox,想给datagrid新增加一行,通过textbox的change事件,改变datagrid带*那行相应的列。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 datagrid和textbox绑定到同一数据源就行! 用一个“添加”按钮的CLICK事件可以吗?string strFirst =this.firstNameText.Text.Trim(); string strLast =this.lastNameText.Text.Trim(); string sendValues = "('"+ intMaxNumberID +"','"+ strFirst +"','"+ strLast +"')"; sendSQL = "insert into studentInfo (StudentID,FirstName,LastName) values " + sendValues; this.link.UpdateDataBase(sendSQL); MessageBox.Show("插入记录成功!","提示"); string tempStrSQL = "select * from " + sendTableName; this.link.SelectDataBase(sendDsPath,tempStrSQL,sendTableName); public int UpdateDataBase(string tempStrSQL) { this.myConnection = new OleDbConnection(connectionString); //使用Command之前一定要先打开连接,后关闭连接,而DataAdapter则会自动打开关闭连接 myConnection.Open(); OleDbCommand tempSqlCommand = new OleDbCommand(tempStrSQL,this.myConnection); int intNumber = tempSqlCommand.ExecuteNonQuery();//返回数据库中影响的行数 myConnection.Close(); return intNumber; }public DataSet SelectDataBase(string dataSourcePath,string tempStrSQL,string tempTableName ) { this.strSQL = tempStrSQL; connectionString += "Data Source =" + dataSourcePath + ";"; this.myConnection = new OleDbConnection(connectionString); this.da = new OleDbDataAdapter(this.strSQL,this.myConnection); this.ds.Clear(); this.da.Fill(ds,tempTableName); return ds;//返回填充了数据的DataSet,其中数据表以tempTableName给出的字符串命名 } 请问,treeview里节点url如何获取? gridview控件当作信箱问题 小弟新手问一个.net中连接sql服务器的问题 为什么抽象类可以创建数组 static属性会被垃圾回收吗? c++的结构转到c# c# 生成bmp格式文件 请介绍一些有大量C#和asp.net源代码下载的网站 RichTextBox中乱码问题 谁帮忙把这句话翻译成C#啊,谢谢,在线等待 VSS不能使用问题! 急急急!按照微软的标准,我的三层结构系统中,每个数据库表都需要一个数据实体?
string strFirst =this.firstNameText.Text.Trim();
string strLast =this.lastNameText.Text.Trim();
string sendValues = "('"+ intMaxNumberID +"','"+ strFirst +"','"+ strLast +"')";
sendSQL = "insert into studentInfo (StudentID,FirstName,LastName) values " + sendValues;
this.link.UpdateDataBase(sendSQL);
MessageBox.Show("插入记录成功!","提示");
string tempStrSQL = "select * from " + sendTableName;
this.link.SelectDataBase(sendDsPath,tempStrSQL,sendTableName);
{
this.myConnection = new OleDbConnection(connectionString);
//使用Command之前一定要先打开连接,后关闭连接,而DataAdapter则会自动打开关闭连接
myConnection.Open();
OleDbCommand tempSqlCommand = new OleDbCommand(tempStrSQL,this.myConnection);
int intNumber = tempSqlCommand.ExecuteNonQuery();//返回数据库中影响的行数
myConnection.Close();
return intNumber;
}
public DataSet SelectDataBase(string dataSourcePath,string tempStrSQL,string tempTableName )
{
this.strSQL = tempStrSQL;
connectionString += "Data Source =" + dataSourcePath + ";";
this.myConnection = new OleDbConnection(connectionString);
this.da = new OleDbDataAdapter(this.strSQL,this.myConnection);
this.ds.Clear();
this.da.Fill(ds,tempTableName);
return ds;//返回填充了数据的DataSet,其中数据表以tempTableName给出的字符串命名
}