VS2010连接SQL问题 我用vs2010自带的工具连接好SQL2005,就是菜单栏的工具——连接到数据库,请问高手之后怎么编程实现查询,从哪里获得Connection指针和Recordset指针 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://blog.csdn.net/fredrickhu/article/details/4961799 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;namespace 留言板_SQL{ class sqlcon { DateTime dt = DateTime.Now; static string sqlcontxt = "Data Source=.;Initial Catalog=book;Integrated Security=True"; SqlConnection conn = new SqlConnection(sqlcontxt); public void show() { string sqlcomtxt = "select * from b_info"; SqlCommand comm = new SqlCommand(sqlcomtxt,conn); conn.Open(); SqlDataReader sqlread = comm.ExecuteReader(); while (sqlread.Read()) { Console.WriteLine("留言人:{0}\t留言时间{1}\n留言标题{2}\n留言内容{3}\n",sqlread["b_i_name"],sqlread["b_i_time"],sqlread["b_i_biaoti"],sqlread["b_i_neirong"]); } conn.Close(); }一个简单的显示数据库的,,,你可以按自己的修改! 求解答关系操作式 虚拟表建立 通过时间段进行统计 求教:有无简版SQL 能不能自动建表 求日期转化字符串的问题? 怎么把ntext(二进制值)字段的值转化为IMAGE字段类型的 关于存储过程的死锁和错误处理的问题。解决问题者百分相送 请问sql server 在delphi下用什么显示都需要那些步骤和控件 linux环境下的PHP如何连接sql server数据库 SQL安装问题 太家帮忙解决个问题
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;namespace 留言板_SQL
{
class sqlcon
{
DateTime dt = DateTime.Now;
static string sqlcontxt = "Data Source=.;Initial Catalog=book;Integrated Security=True";
SqlConnection conn = new SqlConnection(sqlcontxt);
public void show()
{
string sqlcomtxt = "select * from b_info";
SqlCommand comm = new SqlCommand(sqlcomtxt,conn);
conn.Open();
SqlDataReader sqlread = comm.ExecuteReader();
while (sqlread.Read())
{
Console.WriteLine("留言人:{0}\t留言时间{1}\n留言标题{2}\n留言内容{3}\n",sqlread["b_i_name"],sqlread["b_i_time"],sqlread["b_i_biaoti"],sqlread["b_i_neirong"]);
}
conn.Close();
}
一个简单的显示数据库的,,,你可以按自己的修改!