社区
VB
帖子详情
关于datagrid与dataset.table之间的关系的问题
tianqingfeng
2003-10-20 02:39:22
datagrid的数据源设定为dataset.table,如果在程序运行当中用户改变了datagrid当中的数据,对应的dataset.table中的数据是否跟着同步发生变化?例如典型的的情况,程序运行当中,用户通过datagrid表头改变datagrid表的排序方式,对应的dataset当中的表table是否也同步变化?
...全文
35
9
打赏
收藏
关于datagrid与dataset.table之间的关系的问题
datagrid的数据源设定为dataset.table,如果在程序运行当中用户改变了datagrid当中的数据,对应的dataset.table中的数据是否跟着同步发生变化?例如典型的的情况,程序运行当中,用户通过datagrid表头改变datagrid表的排序方式,对应的dataset当中的表table是否也同步变化?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
snakeyin
2003-12-23
打赏
举报
回复
Mark
speedyen
2003-11-27
打赏
举报
回复
up
NoReady
2003-10-21
打赏
举报
回复
1、不会改变。你需要对它进行更新
2、不会改变。只是视图进行了改变
tianqingfeng
2003-10-21
打赏
举报
回复
非常的感谢 大家,尤其 NoReady(亦正亦偏)
NoReady
2003-10-21
打赏
举报
回复
sorry,我说错了:对应的dataset.table中的数据是跟着同步发生变化的。
tianqingfeng
2003-10-21
打赏
举报
回复
能不能详细解释? NoReady(亦正亦偏) “1、不会改变。你需要对它进行更新”是指的datagrid改变时,dataset.table当中的数据不会改变吗?“你需要对它进行更新”中的“它”是指的dataset.table吗?
xdwlb
2003-10-20
打赏
举报
回复
应该不改变,如果改变了排序方式,按照datagrid1.currentrowsindex取出的dataset相应table的记录还是原来的。
xdwlb
2003-10-20
打赏
举报
回复
应该不改变,如果改变了排序方式,按照datagrid1.currentrowsindex取出的dataset相应table的记录还是原来的。
xdwlb
2003-10-20
打赏
举报
回复
应该不改变,如果改变了排序方式,按照datagrid1.currentrowsindex取出的dataset相应table的记录还是原来的。
Database Explorer
This example shows how you can use OleDbSchemaGuid in ADO.NET to fetch Schema information from database. It also shows, how you can use
DataGrid
control, to fill records from
dataset
, and also how to update records from
DataGrid
to database using OleDbDataAdapter and OleDbCommandBuilder. In this example List box is filled with
Table
names of a Specified Database, and by clicking on the
table
name, you can fill records in the
DataGrid
. The wonder of the ADO.NET is that it is total disconnected scenario, and this helps a lot in Web Applications.
.net 连接mysql 安装包 mysqldrivercs
此种方法经过本人开发使用,完全没有
问题
, 希望可以帮到你。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.Odbc; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using MySQLDriverCS; namespace mysql { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { MySQLConnection conn = null; conn = new MySQLConnection(new MySQLConnectionString("localhost", "inv", "root", "831025").AsString); conn.Open(); MySQLCommand commn = new MySQLCommand("set names gb2312", conn); commn.ExecuteNonQuery(); string sql = "select * from exchange "; MySQLDataAdapter mda = new MySQLDataAdapter(sql, conn);
DataSet
ds = new
DataSet
(); mda.Fill(ds, "
table
1"); this.
dataGrid
1.DataSource = ds.
Table
s["
table
1"]; conn.Close(); } } }
CRM客户
关系
管理系统商业项目视频课程
本课程共33讲,购买课程后,可以下载项目需求文档,数据库设计文档,完整的项目源代码,数据库文件等资料,系统采用jsp,servlet,ajax,jquery,easyui,mysql数据库等相关技术实现,系统稳定,高效,快捷;本系统是专门针对各种中小型企业量身定做的CRM客户
关系
管理系统,为企业管客户,管商机,管销售,从而推动业务进展,提高工作效率,管理大数据。
使用ado访问sql server数据库的实验报告
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
this
DataSet
=new
DataSet
(); thisConnection.Open(); thisAdapter.Fill(this
DataSet
, "student"); //在运行时设置
dataGrid
1的数据源和数据成员属性,即在
dataGrid
1中显示数据集中的数据
dataGrid
1.SetDataBinding(this
DataSet
,"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
this
DataSet
=new
DataSet
(); //创建并返回一个与SqlConnection相关联的SqlCommand 对象 SqlCommand thisCommand=thisConnection.CreateCommand(); thisCommand.CommandText="select * from student";//获取或设置要对数据源执行的SQL语句 thisAdapter.SelectCommand =thisCommand ;//获取一个SQL语句,用于在数据源中选择记录 thisConnection.Open();//打开本次设置的数据库连接 thisAdapter.Fill(this
DataSet
,"student");//将以上在数据源student中选择的记录的所有行填充到数据集中。 thisConnection.Close();//断开本次数据库连接 //在运行时设置
dataGrid
1的数据源和数据成员属性,即在
dataGrid
1中显示数据集中的数据
dataGrid
1.SetDataBinding(this
DataSet
,"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
this
DataSet
=new
DataSet
(); SqlCommand thisCommand=thisConnection.CreateCommand(); thisCommand.CommandText="select * from student "; thisAdapter.SelectCommand =thisCommand ; thisConnection.Open(); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); thisAdapter.Fill(this
DataSet
, "student"); DataRow thisRow=this
DataSet
.
Table
s["student"].NewRow();//在 数据集的student
Table
中创建新行 thisRow["sno"]="21";thisRow["sname"]="李梦然";thisRow["ssex"]="男";thisRow["thirthday"]="1987-7-31";thisRow["class"]="95001";//设置新行中的个字段值 this
DataSet
.
Table
s["student"].Rows.Add(thisRow);//将新行添加到数据集的student
Table
中 thisAdapter.Update(this
DataSet
,"student");// 修改数据库表 //以下显示添加后表中的数据 thisCommand.CommandText="select * from student "; thisAdapter.SelectCommand =thisCommand ;
dataGrid
1.SetDataBinding(this
DataSet
,"student"); thisConnection.Close(); }
C#开发和使用中的23个技巧
1.怎样定制VC#
DataGrid
列标题?
DataGrid
Table
Style dgts = new
DataGrid
Table
Style();
dgts.MappingName = "my
Table
"; //my
Table
为要载入数据的Data
Table
DataGrid
TextBoxColumn dgcs = new
DataGrid
TextBoxColumn();
dgcs.MappingName = "title_id";
dgcs.HeaderText = "标题ID";
dgts.GridColumnStyles.Add(dgcs);
。。。
dataGrid
1.
Table
Styles.Add(dgts);
12.怎样把数据库表的二个列合并成一个列Fill进
DataSet
里?
dcChehao = new DataColumn("newColumnName", typeof(string));
dcChehao.Expression = "columnName1+columnName2";
dt.Columns.Add(dcChehao);
Oracle:
select col1||col2 from
table
sql server:
select col1+col2 from
table
VB
16,554
社区成员
110,527
社区内容
发帖
与我相关
我的任务
VB
VB技术相关讨论,主要为经典vb,即VB6.0
复制链接
扫一扫
分享
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章