By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Update data in datagrid

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.