110,552
社区成员
发帖
与我相关
我的任务
分享
//
public static SqlConnection getLocalStrConn()
{
string strConn = "Data Source=xxx.xx.xx.158;database=xxxx;User ID=sa;Pwd=xxx#@!;";
SqlConnection conn = new SqlConnection(strConn);
return conn;
}
//读取数据
public static SqlDataReader GetReadSQL(string strSQL)
{
SqlDataReader myReader;
SqlConnection conn = SQL.getJayStrConn();
SqlCommand comm = new SqlCommand(strSQL, conn);
comm.CommandType = CommandType.Text;
try
{
conn.Open();
myReader = comm.ExecuteReader(CommandBehavior.CloseConnection);
}
catch
{
return null;
}
return myReader;
}