Hi guys, can you pls help me what is the vb code in retrieving my data in the database? my code is this.

Dim SandLine As String
SandLine = txt1S.Text & "," & txt2S.Text & "," & txt3S.Text _
          & "," & txt4S.Text & "," & txt5S.Text & "," & txt6S.Text _
          & "," & txt7S.Text & "," & txt8S.Text & "," & txt9S.Text _
          & "," & txt10S.Text

Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim connectionstring As New OleDbConnection(MSAccessConnection.cnstr)
connectionstring.Open()
sql = "SELECT * FROM tblBatch"
da = New OleDb.OleDbDataAdapter(sql, connectionstring)
da.Fill(ds, "MyDatabase")
connectionstring.Close()

Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsnewrow As DataRow
dsnewrow.Item("btchSand") = SandLine
ds.Tables("MyDatabase").Rows.Add(dsnewrow)
da.Update(ds, "MyDatabase")

As you can see, i manage to save the data in the database field by separating them with the comma. Can you please help me how can I retrieve my data in the textbox again from the database?

Recommended Answers

All 3 Replies

Anyone???

do something like this:

VB.NET Syntax (Toggle Plain Text)

1.
Dim content() As String
2.
Dim s As String = "IT111,IT112,IT113"
3.

4.
content = s.Split(",")

Dim content() As String Dim s As String = "IT111,IT112,IT113" content = s.Split(",")

here u can make a loop in which ur PREREQ field is stored in s (string) and then u can split and check each content like :- content(0), content(1) ,...etc

after above code contents of the array content:

content(0) :"IT111"
content(1) :"IT112"
content(2) :"IT113"

What i am trying to say is use the .split() method and u will get an arrary that contains your data and display it to textboxs

Hi.. Thanks... I Manage to have a different approach but I still used the .split() method. Thanks... Shalom!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.