Dataset to String.

Permit2kill

Member
Joined
Jun 25, 2007
Messages
21
Programming Experience
Beginner
I've been playing around with VB.net/ASP.net and MySQL lately. Mostly just selecting, updating and inserting kind of stuff. I followed an online tutorial on this stuff and I'm having a bit of trouble. I can run the commands fine, but I'm left with a DataSet of information.

VB.NET:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
                Dim myConnection As MySqlConnection
                Dim myDataAdapter As MySqlDataAdapter
                Dim myDataSet As DataSet

                Dim strSQL As String
                
        myConnection = New MySqlConnection("server=localhost; user id=********; password=********; database=********; pooling=false;")

        Dim strAddedName As String = Me.txtAddName.Text
        
        strSQL = "SELECT * FROM users WHERE username = '" & strAddedName & "';"
        myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
        
        myDataSet = New DataSet()
        myDataAdapter.Fill(myDataSet, "users")
        MySQLDataGrid.DataSource = myDataSet
        
        MySQLDataGrid.DataBind()
        myConnection.Close()
End Sub

Essentially, what this code does is pull me a row from my database and seems to store it in a DataSet. How about do I go turning that DataSet and the information in each column into a string format?

Thanks. =)
 
A dataset is a colelction of datatables, a datatable is a collection of datarow. datarows have datacolumns. The whole thing is analogous to a database (having tables with rows and columsn)

Do yourself a favour. Dont use MySQL, it doesnt integrate well at all.

WHile youre learni9ng, use access, sqlserver or oracle. Free versions of all of them exist so there is no good reason to make your learning harder than it needs be by using a "free" database that is not properly supported

To learn how to do data access read the DW2 link in my signature, starting with "creating a simple data application"
 
Back
Top