protected string ConnectSqlServer() { string sResult = ""; string connectStr = "Server=localhost;uid=sa;pwd=sa;database=BiaoWH"; mySqlConnection = new SqlConnection(connecyStr); try { mySqlConnection.Open(); } catch (Exception e) { sResult=e.Message; } return sResult; }
protected DataTable Search(string strSqlcmd) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); try { SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(strSqlcmd,connectStr); mySqlDataAdapter.Fill(ds, "Customers"); dt = ds.Tables[0]; ds.Tables.Remove(dt); } catch(Exception e) { string exm = e.Message; return null; } return dt; }