473,386 Members | 1,720 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,386 software developers and data experts.

databinding a textbox in a webform

Hi there,

I want to bind a text box to a column in my dataset and update changes vice
versa. I'm having a rough time to do so any help or examples appreciated!!

Dim sql As String = "SELECT * FROM Consumer WHERE Consumer.ConsumerID = " &
CustomerID

Dim updatesql As String = "Update set consumer.firstname = " & TextBox1.Text
& " WHERE Consumer.ConsumerID = " & CustomerID

Dim MyOleDbConn As New OleDbConnection(connstr)

Dim myOleDbCmd As New OleDbCommand(sql, MyOleDbConn)

Dim myadapter As New OleDbDataAdapter()

Dim myds As New DataSet()

Dim mytable As DataTable

Dim myrow As DataRow

myadapter.UpdateCommand = New OleDbCommand(updatesql, MyOleDbConn)

myadapter.SelectCommand = New OleDbCommand(sql, MyOleDbConn)

MyOleDbConn.Open()

myadapter.Fill(myds, "Consumer")

If myds.Tables(0).Rows.Count > 0 Then

TextBox1.Text = myds.Tables(0).Rows(0).Item("FirstName")

End If

myrow("FirstName") = "test"

myadapter.Update(myds, "Consumer")

DataGrid1.DataSource = myds

DataGrid1.DataBind()

MyOleDbConn.Close()

End Sub


Nov 18 '05 #1
0 995

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

Similar topics

0
by: Brian Conway | last post by:
I am trying to dynamically generate a dataset that pulls back information based off of a login id, once it has the dataset I want to take information from the dataset and populate editable fields...
0
by: Arne | last post by:
I am able to use databinding for a selecting a record and binding it a webform. I have no idea how to databind a webform for updates. DO you?
2
by: Colin Robinson | last post by:
Help please I have an example class called Person with 2 public properties Firstname and Lastname, I cant create a textbox on an asp.net form bound to the Person.Firstname property Can...
3
by: virlinz | last post by:
Hello I'm a newbie who has a problem with updating the dataset into the database. Maybe I missed a few lines of codes. Please shed some light for me. The following code is working but not like I...
0
by: Alessandro | last post by:
Dears, Using SQLDataSource easily can "capture" values of the controls existent in a WebForm and to send them as parameters for a query or maintenance of data. However, until the moment I didn't...
2
by: John R. Lewis | last post by:
I posted this yesterday with a different email address. I am reposting with my fake-address as given to me by Microsoft so that I can be guraranteed a response from a support representative. Sorry...
0
by: Ivan Sammut | last post by:
Is it possible to bind a textbox on a webform to some field in my database cause I can't get it 2 work. I binded a list of country to a dropdownlist, now all I need is that everytime my users...
4
by: Tor Inge Rislaa | last post by:
Databinding programmatically In my webform I have the code below in the form_load procedure. On the webform I have a GridView control. My question is simply how to bind the GridView to the...
7
by: Naveen | last post by:
I posted this message to another board and have hardly had any views on it, leave alone answers. So I am cross-posting here. This may be a very simple question but I can't get my head around it....
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.