public static void BindDropDownList(DropDownList ddl, string tableName, string text) { string mConn = IConfiguration.getParameter("connectString"); IDBOSQL.IDBO dbo = IDBOSQL.IDBO.getIDBO(mConn); dbo.openDatabase(); DataSet ds = dbo.executeSelectSql("select distinct " + text + " from " + tableName); ddl.DataSource = ds; ddl.DataTextField = text; ddl.DataBind(); dbo.closeDatabase(); }
public static DataTable GetDataTable(string strSql) { string mConn = IConfiguration.getParameter("connectString"); IDBOSQL.IDBO dbo = IDBOSQL.IDBO.getIDBO(mConn); dbo.openDatabase(); try { DataSet ds = dbo.executeSelectSql(strSql); return(ds.Tables[0]); } catch (Exception ex) { throw ex; } }
public static string BuildOrderID(string strTableName, string strCodeColumn) { string mConn = IConfiguration.getParameter("connectString"); IDBOSQL.IDBO dbo = IDBOSQL.IDBO.getIDBO(mConn); dbo.openDatabase(); string strSql = "Select Max(" + strCodeColumn + ") as bh From " + strTableName; DataSet ds = dbo.executeSelectSql(strSql); if (ds.Tables[0].Rows.Count == 0) { return("1"); } else { int orderid = int.Parse(ds.Tables[0].Rows[0]["bh"].ToString()) + 1; return(orderid.ToString()); } }