Search results

  1. A

    Question Update datagridview cell value changes to database in 3-tier architecture

    Hi All, I am currently working on getting Please find the respective Data Access Layer code below; public void UpdateUser(PersonDTO bPerson) { using (SqlConnection conn = new SqlConnection(_connStr)) using (var dCmd = new SqlCommand(@"UPDATE Person SET...
  2. A

    Question Unable to Cast Object Type in 3-Layer Architecture

    Hi All, I am trying to implement the update data record(s) from a data grid view to the database table. I got three Layers implemented and need to update changes to the data grid view data using a data table into my database table. In my Data Access Layer, the respective code looks like below...
  3. A

    Question Displaying data in dataGridView

    Hi All, I am trying to get my head around how the 3-layer architecture works using a sample example. I am able to get the data on to the Presentation Layer, Form_Load event. Please refer my below code, ClassBusinessLayer objLogic; private void Product_Details_Load(object sender...
  4. A

    Answered Update multiple sql database tables using a single Data Table

    Hi, I got a Data Table which is generated at the Form_Load event. The data then populate in to a dataGridView. The user is allowed to add values to a dataGridView column (issueQuantity) and when saving the data, I want to update two tables in the SQL server. However, when I'm running the...
  5. A

    Question The ConnectionString property has not been initialized

    Hi All, I am running a WindowForm application and got a dataGridView where I add a new column(type of boolean) into it, during the Form Load event to select the data rows. The respective code is as follows; //Add column for selection table.Columns.Add("Select Item"...
  6. A

    Question Save dataGridView data for the selected data records

    Hi All, I am working on a small application which got a dataGridView and the first columns got a "CheckBox". My requirement is, if the user has selected/checked the records of the dataGridView, the said records should save in to the database table when hit the "Save" button. However, i have come...
  7. A

    Object reference not set to an instance of an object

    Hi All, I got a dataGridView and the first column's column type is " DataGridViewCheckBoxColumn". My requirement is, I want to pass the data from the dataGridView based on the checked item rows to the database. My code looks like below and when running the application, I am getting the "Object...
  8. A

    Question Load data in to dataGridView based on combo box selection

    Hi, I got a combo box and a datagridview and my requirement is, based on the user's selection of an item in the combo box (Category Name), the respective product details should populate in to the dataGrid View. I got two tables in SQL Server named, tbl_Product (ProductID, ProductName and...
  9. A

    Question Retrieve the data rows with already selected items

    Hi All, I got three tables as shown below; tbl_Product : ProdID, ProdName, Price tbl_Department : DepartmentID, DepartmentName tbl_Allocation : ProdID, DepartmentID The requirement is, the products has to be allocated accordingly to the different departments (assume there are 10 products in...
  10. A

    Question Adding a variable data value to a DataTable

    Hi All, I want to add a variable int value to a DataTable column. I have used one of the Microsoft's solution around DataTable to perform this task. Basically, i got two tables in my SQL Server named, "BulkCopyDemoDifferentColumns" and "BulkCopyDemoMatchingColumns" and the intention is, I want...
  11. A

    Question Use of MARS

    Hi, This is more related to SQL and apologies in advance . However, since I need to clarify this, thought of posting this under the general discussion. I got an issue while trying to execute multiple INSERT queries to SQL database. The error was, "There is already an open DataReader associated...
  12. A

    Question Retrieve a table column data using the PK of the table

    Hi, I got a table (Table1) which got few fields and among them are "costCentreID" which is the PK and the "costCentreName". I got another table(Table2) which got some transaction related data (which got "costCentreID" as a field) and my requirement is to load the data, based on a selection...
  13. A

    Question Retrieve a value from DB based on the user login variable value

    Hi, Thanks for the above respond. Now, my requirement is to retrieve a single string value from the database based on the variable value I collected at the user login point. Basically, I want to get the "costCentreCode" which relates to individual user and pass it to a textbox. My class...
  14. A

    Question Store user login data in to a Class and reuse within the application

    Hi All, I got a small application and need to store the user's login details (ex - user name) into a static variable. I created a class named, "UserData" and it looks like below; public class UserData { public static string userName; } I need to access the "userName"...
  15. A

    Question Convert dataGridView data in to text

    Hi, I got an issue with converting dataGridView Data in to text prior to save the data into a SQL DB. Basically, I want to use the parameters to pass the data into the DB and finding it bit difficult to work around that. My code is as follows;
  16. A

    Convert a textbox value to int when saving the data

    Hi, I got an error stating, " Input string was not in a correct format" when trying to insert a window form data in to a SQL database table. I got a combobox named "cmbCostCentre" and when the user selects a cost centre, the respective Cost Centre ID is retrieved to another textbox named...
  17. A

    Dynamically change the dataGridView's column value based on user input

    Hi All, I got a dataGridView which got the following fields, orderID, drugID, requestquantity and balancequantity MyDataGridView looks like below; The above said data is loaded from a SQL DB table. What I want to perform is, whenever a user enter a value in to the "Issue Quantity" column...
  18. A

    Question Calling a method in formload event in another method

    Hi All, I am developing an app to manage stocks. I am loading drug orders related data into a window form (basically to a dataGridView) and need to calculate the sum of a column. For the said, purpose, I am using the below code within the FormLoad event; int d = 0; for(int n=0; n<...
  19. A

    Loading data from a sql database table based on a variable value

    Hi All, I am new to visual C# and currently working on developing an application. I got a data base table which got a integer field named "orderID" and I want to access the data relating to a given integer variable which matches with the respective orderID value. For example, I have declared...
Top Bottom