string strConn = "server=.\\SQLExpress;database=dbname;User ID=Lucy;Password=123456;Trusted_Connection=True;";
SqlConnection myConn = new SqlConnection(strConn);
myConn.Open();
String strSQL = @"select * from XXX where a="+a;
SqlCommand myCommand = new SqlCommand(strSQL, myConn);
SqlDataReader myDataReader = myCommand.ExecuteReader();
string tmpHTML;
while (myDataReader.Read())
{
//myDataReader["abc"].ToString()
}
myConn.Close();
留言列表