Csharp和SQL连接
来源:互联网 发布:曹雪松淘宝技术总监 编辑:程序博客网 时间:2024/06/18 01:24
using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
namespace file
{
class Friends
{
static void Main(string[] args)
{
try
{
DbConnection connection_f = new SqlConnection();
DbCommand command_f = new SqlCommand();
connection_f.ConnectionString = "Data Source= GENGRAN\\SQLEXPRESS;Initial Catalog = Friends;Integrated Security=True";
//User Id = sa;Password = ghwghw";
connection_f.Open();
command_f.Connection = connection_f;
DbDataAdapter adapter_f = new SqlDataAdapter();
DataSet ds = new DataSet();
//command_f.CommandText = "insert into friend values('138',134,null,null)";
//command_f.ExecuteNonQuery();
command_f.CommandText = "select * from friend";
adapter_f.SelectCommand = command_f;
adapter_f.Fill(ds);
foreach (DataRow dr in ds.Tables[0].Rows)
{
Console.WriteLine(dr["Name"]);
}
connection_f.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.Read();
}
}
}
- Csharp和SQL连接
- 网页websocket正常和C#websocket-csharp 断开连接问题
- Csharp连接Access数据库
- CSharp直接连接MySQL
- CSharp 使用ADO连接 SQLServer2008
- sql and csharp: Split Function
- sql and csharp: Split Function
- csharp
- Csharp
- Csharp中的类和对象
- csharp:存儲過程輸出參數,和返回值
- csharp:存儲過程輸出參數,和返回值
- WPF 4.5和Csharp (1)
- Csharp进阶:栈和队列
- csharp tcp/ip连接发送消息
- Csharp run sql script create database
- Csharp run sql script create database
- sql连接类型:内连接、外连接和交叉连接
- TableLayout
- 查询Linux系统是32位还是64位
- 推荐几款优秀的数据比较同步工具
- 拖动行的代码实现
- 构造函数、拷贝构造函数和析构函数的的调用时刻及调用顺序
- Csharp和SQL连接
- Java关键字final、static使用总结
- 通讯录Index
- 多重继承
- Input Method Manager (IMM):输入法管理器
- LINK : fatal error LNK1104: 无法打开文件“opencv_calib3d231d.lib;” 解决方案
- k-means--python版本
- poj 2051 (用Priority_queue求解
- 冯唐:在江湖上混需要养成的10个好习惯