请问高手大吓,是用ODBC还是ado直接连sql server好呢?
解决方案 »
- exec master..xp_cmdshell 'bcp Vegatable.dbo.V_out out C:\wo.xls -c -q -s"zyp" -u"sa" -p"asdasd"'错误!
- 安装SQL SERVER问题
- 求一SQL语句
- 请问兄弟们'/?'指的是什么啊
- 月报表统计的问题
- MSSQL服务突然不能启动,提示系统找不到指定路径,如何解决
- 动态sql的问题
- 【CSDN】【多级分类档案ID自动编码存储过程的实现遇到难题,大家帮忙看看,跪谢】
- 跪求一个多行转字符串的funtion
- 求按时间查询的SQL代码写法
- 帮忙看条SQL 在线等...
- sql2000数据库在断电后出错,RMB求修复
{
using (SqlConnection con = new SqlConnection(@"Data Source=DEMO;Initial Catalog=DEMODB;Integrated Security=True"))
{
string sql = "select person from MossApproveConfig where id= '" + id + "'";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.Fill(ds, "Data");
con.Close();
return ds;
}
}
{
int i=0;
SqlConnection myConnection = new SqlConnection(connectionString);
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandText = "sp_insertyjlm";
myCommand.Parameters.Add("@yjlmbh", SqlDbType.Int).Value = yjlmbh;
myCommand.Parameters.Add("@yjlmmc", SqlDbType.VarChar, 20).Value = yjlmmc;
myCommand.Parameters.Add("@yjlmms", SqlDbType.VarChar, 160).Value = yjlmms;
myConnection.Open();
try
{
i = myCommand.ExecuteNonQuery();
}
finally
{
myConnection.Close();
}
return i;
}
public DataTable getyjlmmc()
{
SqlConnection myConnection = new SqlConnection(connectionString);
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandText = "sp_getyjlmmc";
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataTable dt = new DataTable();
myAdapter.Fill(dt);
return dt;
}