社区
C#
帖子详情
在window form中如何连sql server数据库,谢谢
jjyzhw111
2003-08-21 03:05:53
在window form中如何连sql server数据库,谢谢
...全文
145
4
打赏
收藏
在window form中如何连sql server数据库,谢谢
在window form中如何连sql server数据库,谢谢
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
jjyzhw111
2003-08-21
打赏
举报
回复
thanks a lot of
dahuzizyd
2003-08-21
打赏
举报
回复
string strSql = "select department.* from department";
string strConn ="data source=YL5;initial catalog=Address;workstation id=YL5;packet size=4096";
SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd_dep = new SqlCommand(strSql,conn);
SqlDataAdapter adp_dep = new SqlDataAdapter();
adp_dep.SelectCommand = cmd_dep;
DataSet ds = new DataSet();
conn.Open();
adp_dep.Fill(ds);
建议你还是先看看帮助:
Visual Basic 和Visual C# --访问数据--数据演练
yanyunpaladin
2003-08-21
打赏
举报
回复
sdk里类库的例程多得就是,看看就行了^_^
system.data.xxx随便看一个就行了
zhehui
2003-08-21
打赏
举报
回复
string sqltxt="Persist Security Info=False;User ID=sa;Initial Catalog=zhongtian;Data Source=ytf;Password=xu;";
SqlConnection sqlcon=new SqlConnection(sqltxt);
try
{
sqlcon.Open();
SqlCommand sqlcm=new SqlCommand("select Max(product_id) from product_class where product_id like '"+e1+"__'",sqlcon);
SqlDataReader dr=sqlcm.ExecuteReader();
if(dr.Read())
{
if(e1.Length==4)
{
textBox1.Text=Int32.Parse(dr.GetValue(0).ToString().Substring(4));
}
//else
//{
// textBox1.Text=dr.GetValue(0).ToString().Substring(6);
//}
//textBox1.Text=dr.GetValue(0).ToString();
sqlcon.Close();
}
}
catch(System.Data.SqlClient.SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
sqlcon.Close();
}
}
db-备份
sql
server
数据库
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.
Window
s.
Form
s; using System.IO; using System.Linq;...
db-查找并替换字符串
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.
Window
s.
Form
s; using System.Dat...
db-在查询时对数值进行取整
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.
Window
s.
Form
s; using System.Dat...
【C#】如何使用C#与
SQL
Server
数据库
进行交互
(1)在工具箱
中
拖出dataGridView控件和botton控件(可以改名是其功能明确)(3)创建成功后会有源
数据库
以及其镜像(我们后续操作都在镜像完成就好)(5)在设计界面再拖入botton以及一个textbox(用于根据姓名查询)()(3)双击双击botton2,进入代码编写(插入数据)(4)双击双击botton3,进入代码编写(查询数据)(2)双击botton1,进入代码编写(检查链接)(4)新建
数据库
XSCJDB(学生成绩
数据库
)(6)编写botton5代码(按名字查询)
用Visual C#访问DB2
数据库
开发者在线 Builder.com.cn 更新时间:2008-07-20作者: 来源:...
用VisualC#访问DB2
数据库
开发者在线Builder.com.cn更新时间:2008-07-20作者:来源:本文关键词:访问DB2C#与
数据库
C#在VisualStudio.NETBeta1版本
中
访问IBMDB2等非
SQL
Server
数据库
通常是使用ADO.NET的ODBC方法,而在Beta2
中
则改用OLEDB方式存取
数据库
。Beta1
中
连接字符串主要需声明
数据库
...
C#
111,128
社区成员
642,536
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章