public void LoadLvList() { try { SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand("FetchUserAccessByPwd", cnSQL); cmdOk.Visible = true; cmSQL.CommandType = CommandType.StoredProcedure; switch (listQuery1) { case "SystemUser": cmSQL.CommandText = "FetchAllUserAccess"; // '-------------Accounts break; case "Clients": cmSQL.CommandText = "SELECT [Code] ,[Telephone],[Name],[Outline],[Address],[Email] FROM [Register] WHERE [Discontinue]<>1"; cmSQL.CommandType = CommandType.Text; break; case "Services": cmSQL.CommandText = "SELECT [Sn],[TransDate],[RefNo],[Name],[Telephone] ,[ServiceRendered] ,[ValueOfService] ,[AmountPaid] ,[AmountChargedFromReward],[Username] FROM [RewardAssured].[dbo].[Services] ORDER BY [TransDate] DESC"; cmSQL.CommandType = CommandType.Text; break; } cnSQL.Open(); dataAdapter = new SqlDataAdapter(cmSQL); //"AC_FetchAllPaymentVouchers", strConnect) SqlCommandBuilder commandBuilder = new SqlCommandBuilder(this.dataAdapter); DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; this.dataAdapter.Fill(table); this.bindingSource.DataSource = table; cmSQL.Dispose(); DGrid.Refresh(); lblCount.Text = DGrid.Rows.Count.ToString(); //filterStatusLabel.Text = DGrid.Rows.Count.ToString + " of " + DGrid.Rows.Count.ToString SelColumn.Minimum = 1; SelColumn.Maximum = DGrid.Columns.Count; MyModules.formatGrid(DGrid); return; } catch (Exception ex) { MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); // MessageBox.Show("Ooops! ERROR", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void LoadLvList() { try { SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand("FetchUserAccessByPwd", cnSQL); cmdOk.Visible = true; cmSQL.CommandType = CommandType.StoredProcedure; switch (listQuery1) { case "SystemUser": cmSQL.CommandText = "FetchAllUserAccess"; // '-------------Accounts break; case "ActiveSchoolList": cmSQL.CommandText = "SELECT [Sn] AS RefNo,[SchName] ,[SchAddress],[State] FROM [RegisterSchool] WHERE InActive=0"; cmSQL.CommandType = CommandType.Text; break; case "AllPayRequest": cmSQL.CommandText = "AC_FetchAllPayRequest"; cmSQL.Parameters.AddWithValue("@BillType", qryPrm); break; } cnSQL.Open(); dataAdapter = new SqlDataAdapter(cmSQL); //"AC_FetchAllPaymentVouchers", strConnect) SqlCommandBuilder commandBuilder = new SqlCommandBuilder(this.dataAdapter); DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; this.dataAdapter.Fill(table); this.bindingSource.DataSource = table; cmSQL.Dispose(); DGrid.Refresh(); lblCount.Text = DGrid.Rows.Count.ToString(); //filterStatusLabel.Text = DGrid.Rows.Count.ToString + " of " + DGrid.Rows.Count.ToString SelColumn.Minimum = 1; SelColumn.Maximum = DGrid.Columns.Count; MyModules.formatGrid(DGrid); return; } catch (Exception ex) { MessageBox.Show("Ooops! ERROR :" + char.ConvertFromUtf32(13) + ex, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); // MessageBox.Show("Ooops! ERROR", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }