关于SelectCommand

当当当当当家 2016-10-10 02:39:34
数据绑定:SelectCommand="Business.AWFForm.List"红色部分是什么意思
...全文
295 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
当当当当当家 2016-10-17
  • 打赏
  • 举报
回复
我已经找到了
当当当当当家 2016-10-11
  • 打赏
  • 举报
回复
引用 6 楼 daixf_csdn 的回复:
[quote=引用 5 楼 cfa3288 的回复:] [quote=引用 4 楼 daixf_csdn 的回复:] 没见过这种写法。 你这个代码写在哪里的都不知道,如果写在后台,怎么会不出错?
写在aspx页面上的[/quote] 看起来像一种自定义的格式[/quote] 有个Business文件夹,文件夹下有AWFFormList.aspx文件,这段代码就是写在AWFFormList.aspx里面的,所以我看不懂
当当当当当家 2016-10-11
  • 打赏
  • 举报
回复
<web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="Business.AWFForm.List" DefaultSortExpression="ID DESC" EnableViewState="true"> </web:SmartSqlDataSource> 这是一部分代码
圣殿骑士18 2016-10-11
  • 打赏
  • 举报
回复
引用 5 楼 cfa3288 的回复:
[quote=引用 4 楼 daixf_csdn 的回复:] 没见过这种写法。 你这个代码写在哪里的都不知道,如果写在后台,怎么会不出错?
写在aspx页面上的[/quote] 看起来像一种自定义的格式
当当当当当家 2016-10-11
  • 打赏
  • 举报
回复
引用 4 楼 daixf_csdn 的回复:
没见过这种写法。 你这个代码写在哪里的都不知道,如果写在后台,怎么会不出错?
写在aspx页面上的
圣殿骑士18 2016-10-11
  • 打赏
  • 举报
回复
没见过这种写法。 你这个代码写在哪里的都不知道,如果写在后台,怎么会不出错?
当当当当当家 2016-10-10
  • 打赏
  • 举报
回复
引用 2 楼 sp1234 的回复:
嗯,前一页是 https://msdn.microsoft.com/zh-cn/library/tyy0sz6b(v=vs.100).aspx 应该花2天时间完整地学习一下 ado.net。
是啊,我是菜鸟,那那个绑定数据里面的红色字体是什么意思呢?
  • 打赏
  • 举报
回复
嗯,前一页是 https://msdn.microsoft.com/zh-cn/library/tyy0sz6b(v=vs.100).aspx 应该花2天时间完整地学习一下 ado.net。
  • 打赏
  • 举报
回复
https://msdn.microsoft.com/zh-cn/library/yy6y35y8%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396 估计你没有正规学习 ado.net。可以看看例子,学习一下。
C# oracle 类 事务处理 #region 公有方法 public void JoinTransaction(Transaction transaction) { if (this._transaction != null) { throw new Exception("对象已经在另一个事务中"); } else { this._transaction = transaction.DataBaseTransaction; } } public void QuitTransaction() { if (this._transaction != null) { // 确保_dataAdapter对象的各命令的连接不是事务的连接,以免Dispose _dataAdapter对象时,意外关闭事务的连接。 if (this._dataAdapter != null) { if (this._dataAdapter.SelectCommand != null) { if (this._dataAdapter.SelectCommand.Connection != null) if (this._dataAdapter.SelectCommand.Connection.Equals(this._transaction.Connection)) this._dataAdapter.SelectCommand.Connection = null; } if (this._dataAdapter.InsertCommand != null) { if (this._dataAdapter.InsertCommand.Connection != null) if (this._dataAdapter.InsertCommand.Connection.Equals(this._transaction.Connection)) this._dataAdapter.InsertCommand.Connection = null; } if (_dataAdapter.UpdateCommand != null) { if (this._dataAdapter.UpdateCommand.Connection != null) if (this._dataAdapter.UpdateCommand.Connection.Equals(this._transaction.Connection)) this._dataAdapter.UpdateCommand.Connection = null; } if (_dataAdapter.DeleteCommand != null) { if (this._dataAdapter.DeleteCommand.Connection != null) if (this._dataAdapter.DeleteCommand.Connection.Equals(this._transaction.Connection)) this._dataAdapter.DeleteCommand.Connection = null; } } //确保本对象的连接不是事务的连接,以免本对象Dispose时,意外关闭事务的连接。 if (this._connection != null) { if (this._connection.Equals(this._transaction.Connection)) this._connection = null; } // this._transaction = null; } } #endregion
1,主界面 2查询功能 ‘ private void chaxun_Click(object sender, System.EventArgs e) { SqlConnection thisConnection=new SqlConnection("Data Source=LocalHost;Integrated Security=SSPI;Initial Catalog=李梦然07060021"); //表示到SQL Server的一个实例的连接 SqlCommand thisCommand=new SqlCommand("select * from student where sno='"+textBox1.Text+"'",thisConnection); SqlDataAdapter thisAdapter=new SqlDataAdapter(); thisAdapter.SelectCommand=thisCommand; DataSet thisDataSet=new DataSet(); thisConnection.Open(); thisAdapter.Fill(thisDataSet, "student"); //在运行时设置 dataGrid1的数据源和数据成员属性,即在dataGrid1中显示数据集中的数据 dataGrid1.SetDataBinding(thisDataSet,"student"); thisConnection.Close(); } 3浏览功能 private void liulan_Click(object sender, System.EventArgs e) { //用SqlConnection对象连接SQL Server数据库魏菊丽20086666 SqlConnection thisConnection=new SqlConnection("Data Source=LocalHost;Integrated Security=SSPI;Initial Catalog=李梦然07060021"); SqlDataAdapter thisAdapter=new SqlDataAdapter(); DataSet thisDataSet=new DataSet(); //创建并返回一个与SqlConnection相关联的SqlCommand 对象 SqlCommand thisCommand=thisConnection.CreateCommand(); thisCommand.CommandText="select * from student";//获取或设置要对数据源执行的SQL语句 thisAdapter.SelectCommand =thisCommand ;//获取一个SQL语句,用于在数据源中选择记录 thisConnection.Open();//打开本次设置的数据库连接 thisAdapter.Fill(thisDataSet,"student");//将以上在数据源student中选择的记录的所有行填充到数据集中。 thisConnection.Close();//断开本次数据库连接 //在运行时设置 dataGrid1的数据源和数据成员属性,即在dataGrid1中显示数据集中的数据 dataGrid1.SetDataBinding(thisDataSet,"student"); } 4,插入一个新列 private void button1_Click(object sender, System.EventArgs e) { SqlConnection thisConnection=new SqlConnection("Data Source=LocalHost;Integrated Security=SSPI;Initial Catalog=李梦然07060021"); SqlDataAdapter thisAdapter=new SqlDataAdapter(); DataSet thisDataSet=new DataSet(); SqlCommand thisCommand=thisConnection.CreateCommand(); thisCommand.CommandText="select * from student "; thisAdapter.SelectCommand =thisCommand ; thisConnection.Open(); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); thisAdapter.Fill(thisDataSet, "student"); DataRow thisRow=thisDataSet.Tables["student"].NewRow();//在 数据集的student Table中创建新行 thisRow["sno"]="21";thisRow["sname"]="李梦然";thisRow["ssex"]="男";thisRow["thirthday"]="1987-7-31";thisRow["class"]="95001";//设置新行中的个字段值 thisDataSet.Tables["student"].Rows.Add(thisRow);//将新行添加到数据集的student Table中 thisAdapter.Update(thisDataSet,"student");// 修改数据库表 //以下显示添加后表中的数据 thisCommand.CommandText="select * from student "; thisAdapter.SelectCommand =thisCommand ; dataGrid1.SetDataBinding(thisDataSet,"student"); thisConnection.Close(); }

8,834

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 组件/控件开发
社区管理员
  • 组件/控件开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧