SQL連線

  • 1073
  • 0
  • SQL
  • 2013-03-11

摘要:SQL連線搜尋不到預設值

@如果搜尋不到預設值的話


            string mssql = "MSSQL2";
            GenericCore.DBSource MyCommandName = GenericCore.DBSource.SQL;
            GenericCore myname = new GenericCore(MyCommandName, mssql);

            SqlCommand myCommandA = new SqlCommand(strSQL, myname.GetDBDaoObject().GetConnection);
            //SqlCommand myCommand = new SqlCommand(strSQL);

            myCommandA.CommandType = CommandType.Text;
            //myCommandA.Connection = GetDBDaoObject().GetConnection;
            myCommandA.CommandTimeout = 120;
            myCommandA.Parameters.Clear();

 

@ SQLCOMMAND塞入DS


 SqlDataAdapter myapter = new SqlDataAdapter(myCommandA);
 DataSet ds = new DataSet();
 myapter.Fill(ds);
 myCommandA.Dispose(); //釋放