public class DataBase1
{
private static string ConnString = "server=.;database=xcgl;uid=sa;pwd=123;";
public DataTable GetListReDataTable(string paramSql)
{
DataTable mydt = new DataTable();
SqlConnection mysqlconnection = new SqlConnection(ConnString);
SqlCommand mycmd = new SqlCommand();
mysqlconnection.Open();
mycmd.Connection = mysqlconnection;
= paramSql;
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mycmd);
mySqlDataAdapter.Fill(mydt);(在这里出现问题“对象名xcgl无效”)
mysqlconnection.Close();
return mydt;
}
public int myExecuteNonQuery(string paramStr)
{
int returnValue = 0;
SqlConnection mysqlconnection = new SqlConnection(ConnString);
mysqlconnection.Open();
SqlCommand mysqlcom = new SqlCommand(paramStr, mysqlconnection);
returnValue = mysqlcom.ExecuteNonQuery();
mysqlconnection.Close();
return returnValue;
}
}