473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Update data in datagrid

Hi all,

I am working on a .net app using Framework 1.1
I have a datagrid which is getting data from a dataset, that is bound
to multiple tables.
Basically I have a datagrid, a textbox and a button the form. What I
would like to do is bind data to datagrid and get one of the field from
datasource to display in the text box just below the datagrid. I want
to edit existing rows both in datagrid and textbox, when the button is
pressed, the data should be save to database. Is there any way to
accomplish this? I searched all forums but couldn't find any solution
to accomplish this.
My Form_Load code is as below
**************************************************
Dim strConn = "Server=localhost;Database=TRASAR2;User
ID=sa;Password=nlasalle120;"
Dim myConn As SqlConnection = New SqlConnection(strConn)
Dim myDs As DataSet = New DataSet

Dim Sql As String
Sql = "SELECT DISTINCT CustomerName, FacilityName, ControllerName,
LastName+' '+FirstName UserName, UserType, EmailAddress As Email1,
Email1Alarms,Email2, Email2Alarms, Email3, Email3Alarms, EmailList,
a.UserID, d.ControllerID FROM UMaster_New a INNER JOIN CustMaster b ON
a.CustomerID=b.CustomerID INNER JOIN FMaster c ON
b.CustomerID=c.CustomerID INNER JOIN CMaster_New d ON
c.FacilityID=d.FacilityID INNER JOIN CAccess e ON
d.ControllerID=e.ControllerID AND a.UserID=e.UserID"

myConn.Open()
Dim myDa As SqlDataAdapter = New SqlDataAdapter(Sql, myConn)
myDa.SelectCommand.CommandType = CommandType.Text
myDa.Fill(myDs, "Users")

DataGrid1.DataSource = myDs.Tables("Users")
TextBox1.DataBindings.Add("Text", myDs.Tables(0), "EmailList")

myConn.Close()
**************************************************
My app needs the data to be updated to UMaster_New table and to
CMaster_New table.

Thanks in advance.

Mar 27 '06 #1
0 811

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: abdoly | last post by:
i wrote a code to update datagrid with the datagrid updatecommand but i cant get the updated values after being update that is the code private void DataGrid1_UpdateCommand(object source,...
3
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
5
by: Jay Villa | last post by:
Is it possible to update only few columns in datagrid during OnUpdateCommand event ? If so, could you help me .... -thanks Jay
4
by: Jonathan Upright | last post by:
Greetings to anyone who can help: I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable DataGrid" at the project selector screen. As you may know, it defaults to the Microsoft...
1
by: mursyidatun ismail | last post by:
Dear all, database use: Ms Access. platform: .Net i'm trying to update a record/records in a table called t_doctors by clicking da edit link provided in the database. when i ran through da...
3
by: Jim | last post by:
I have a datagrid with a DataAdapter as the DataSource. The user fills in their data for 3 columns and I want to programically add a value to the 4th (invisible) column (employee number). That way...
5
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
1
by: Sharon | last post by:
Hello All, Is it possible to update Sql Table through DataGrid. I have a DataGrid which is being populated through a stored procedure, all i wanted to do is to update one field...
1
by: geeteshss | last post by:
Dear all, actually i spent a whole month on the R&D of datagrid edit ,update,cancel events but recently my guide told me to make it user friendly because no user would like to go on searching rows...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.