-
C#读取数据库内容并在dataGridView中显示
C#从数据库中读取内容并显示在dataGridView中,这似乎是一个很实用的功能,在数据库应用的时候,我们都要通过dataGridView来显示数据,这个例子可帮助初学者很好的掌握此功能的具体实现,一些代码片段分享如下:
private void button1_Click(object sender, EventArgs e)
{
//实例化SqlConnection变量conn,连接数据库
conn = new SqlConnection("server=.;database=db_15;uid=sa;pwd=");
//实例化SqlDataAdapter对象
SqlDataAdapter sda = new SqlDataAdapter("select * from tb_emp", conn);
DataSet ds = new DataSet(); //实例化DataSet对象
sda.Fill(ds);//使用SqlDataAdapter对象的Fill方法填充DataSet
dataGridView1.DataSource = ds.Tables[0];//设置dataGridView1控件的数据源
dataGridView1.RowHeadersVisible = false;//禁止显示行标题
//使用for循环设置控件的列宽
for (int i = 0; i < dataGridView1.ColumnCount; i++)
{
dataGridView1.Columns[i].Width = 84;
}
button1.Enabled = false;//禁用按钮
dataGridView1.Columns[0].ReadOnly = true;//将控件设置为只读
}
private DataTable dbconn(string strSql)//建立一个DataTable类型的方法
{
this.adapter = new SqlDataAdapter(strSql, conn);//实例化SqlDataAdapter对
- 2022-07-24 21:44:03下载
- 积分:1
-
C# 进销存系统源码(三层架构,含数据库)
1、首先保证计算机上已经成功安装SQL Server 2005 2、先创建数据库 3、再把脚本在创建好的数据库中执行即可创建表 4、请把源代码中的UI模块中的App.config文件修改连接字符串
- 2017-04-28下载
- 积分:1
-
big
visual c++6.0编程实现对图像的缩放处理(vc++6.0 program to achieve the scaling of the image processing
)
- 2009-04-26 10:30:50下载
- 积分:1
-
uCOS-III+STemWin5.22+FatFS(含IAR和MDK)
STM32F407平台下实现 uCOS-III+STemWin5.22+FatFS ,代码注释详细,希望能帮助大家(STM32F407 UCOS-III+STemWin5.22+FatFS is implemented on the platform. The code annotations are detailed. I hope to help you all.)
- 2019-03-06 14:37:53下载
- 积分:1
-
farContral
远程控制小系统,用VC实现,在VC6.0下编译通过(small remote control system, with VC in the next compile VC6.0)
- 2007-04-17 08:44:19下载
- 积分:1
-
STM32H745_Ethernet
Trying to get Ethernet, LWIP and FreeRTOS working on the STM32H745. Testing on the NUCLEO-H745ZI-Q using FW_1.7 and the STM32CubeIDE.
## Instructions on how to get started:
* [LWIP without RTOS](Documentation/lwip_nortos.md)
* [LWIP with RTOS](Dcumentation/lwip_rtos.md)
## Bugs and improvements
* [SysTick not increasing ticks](Documentation/no_systick.md)
* [No DHCP IP when starting without ethernet cable](Documentation/dhcp_nocable.md)
## Current status:
* RTOS works (blinky)
* LWIP works (nucleo board gets IP from DHCP on router)
* HTTP test server works (navigate to http:///index.html for demo)
- 2021-07-25 00:31:02下载
- 积分:1
-
最后一个了,呜 ,好累了,管理员,怎么这么搞哟
最后一个了,呜 ,好累了,管理员,怎么这么搞哟-the last one, Woo, a tired, caretakers, so how engaging yo
- 2022-06-13 20:07:51下载
- 积分:1
-
SchoolC2C
一个简单的校园二手市场交易程序,可以进行用户注册并发布交易信息
可以对交易产品进行评论,也可以按照标题或内容进行站内搜索
数据绑定控件采用的是GridView
管理员后台可以对商品信息管理、用户信息管理进行管理
管理员登录地址:admin_login.aspx
默认帐号/密码:51aspx/51aspx
DB_51aspx下为Sql数据库,附加即可(A simple secondary market transactions campus program, you can perform user registration and post transaction information can be traded product reviews, you can also follow the title or content Search data-bound control uses GridView administrator background information on the goods can be managed User information management to manage administrator login Address: admin_login.aspx default account/password: 51aspx/51aspx DB_51aspx under the Sql database, you can attach)
- 2013-11-03 21:48:45下载
- 积分:1
-
Set
实现wiform窗体向INI文件读取以及写入(This file is a program that reads and writes the INI configuration file in c#)
- 2017-08-18 14:33:11下载
- 积分:1
-
深度优先搜索
c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。c语言代码,对路径进行搜索,遍历。
- 2022-03-19 03:03:46下载
- 积分:1