注册 登录
编程论坛 VC.NET论坛

制作查询、删除界面出问题,新手求助

a741566797 发布于 2012-06-10 02:10, 5793 次点击
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;
        }

    }
0 回复
1