string myConnectString ="server=localhost;uid=sa;pwd=;database=forum";
SqlConnection myConnection = new SqlConnection(myConnectString);
myConnection.Open(); //连接要先打开 SqlCommand mycommand;
mycommand.connection = myConnection;
SqlDataReader rs;
SqlConnection myConnection = new SqlConnection(myConnectString);
myConnection.Open(); //连接要先打开 SqlCommand mycommand;
mycommand.connection = myConnection;
SqlDataReader rs;
dim mycommand as new sqlcommand("...",connection)
mycommand.connection.open
SqlConnection myConnection = new SqlConnection(myConnectString);
string selectCmd = "select id from usermain where userid='"+userid+"' and userpassword='"+password+"'";
SqlCommand myCommand= new SqlCommand( selectCmd, myConnection);
myCommand.Connection.Open();
SqlDataReader sqlDr = myCommand.ExecuteReader();
while (sqlDr.Read())
{
}
sqlDr.Close();
myCommand.Connection.Close();