Here's my function:
How do I make this error go away? It is returning oBindingsource if all goes well. Is this just a warning or an actual error that prevents me from building?Code:public static BindingSource GetAllRecords(string table) { string sSQL = null; System.Data.SqlClient.SqlConnection cnGetRecords = new SqlConnection(DataMSSQL.GetConnectionString("MSSQLConnection")); System.Data.SqlClient.SqlCommand cmdGetRecords = new SqlCommand(); switch (table) { case "clients": sSQL = "SELECT * FROM vw_AlphaClients"; break; case "counties": sSQL = "SELECT * FROM vw_AlphaCounties"; break; case "employees": sSQL = "SELECT * FROM vw_AlphaEmployees"; break; case "jobs": sSQL = "SELECT * FROM vw_NumJobs"; break; case "states": sSQL = "SELECT * FROM vw_AlphaStates"; break; case "subdivisions": sSQL = "SELECT * FROM vw_AlphaSubdivisions"; break; case "surveys": sSQL = "SELECT * FROM vw_AlphaSurveys"; break; case "surveysCounties": sSQL = "SELECT * FROM vw_AlphaSurveysCounties"; break; case "types": sSQL = "SELECT * FROM vw_AlphaTypes"; break; case "units": sSQL = "SELECT * FROM vw_AlphaUnits"; break; } //string sSQL = "GetAllRecords"; SqlDataAdapter daGetRecords; DataTable dtGetRecords; cmdGetRecords.CommandText = sSQL; cmdGetRecords.CommandType = CommandType.Text; try { HandleConnection(cnGetRecords); System.Windows.Forms.BindingSource oBindingSource = GetBindingSource(cmdGetRecords); if (oBindingSource != null) { return oBindingSource; } else { throw new Exception("There was no BindingSource returned"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } cnGetRecords.Close(); }
Thanks!


Reply With Quote