public virtual DataTable QueryInfo(string xSQL, fc.DBInfo xDBInfo) { SqlConnection conn = null; conn = null; conn = new SqlConnection(makeConnectString(xDBInfo)); try { conn.Open(); SqlCommand myCommand = null; myCommand = new SqlCommand(xSQL, conn); SqlDataAdapter sqldataadpt = new SqlDataAdapter(myCommand); DataTable dt1 = new DataTable(); sqldataadpt.Fill(dt1); conn.Close(); return(dt1); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); fc.ErrorLog(ex.Message); return(null); } }
public string makeConnectString(fc.DBInfo xDBInfo) { string mRes = "Persist Security Info=true" + ";Integrated Security=" + ";Data Source=" + xDBInfo.IP + ";Initial Catalog=" + xDBInfo.DB + ";User ID=" + xDBInfo.ID + ";Password=" + xDBInfo.PW; return(mRes); }