Results 1 to 2 of 2

Thread: Assigning table field to an object

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    1

    Assigning table field to an object

    HEy i'm new with vb.net. I'm using dataset to retrieve my information.I know how to show a field from a table in a textbox. What I now want to do is to assign a certain field (ex Cust_name) to an object of the class customer(ex customer.name) I don't know how to start with this.
    If anyone can help me out ....

    could thus not be something like
    customer.name = .......

    Thnx in avant......

  2. #2
    Junior Member
    Join Date
    Jan 2004
    Location
    Asia
    Posts
    16

    Cool I think this was your Problem Right!!

    Dim con As New System.Data.OleDb.OleDbConnection("Provider =microsoft.jet.oledb.4.0;Data source=" + Application.StartupPath.ToString() + "/super.mdb")
    ' super.mdb Database name
    Dim com As New System.Data.OleDb.OleDbCommand("select * from temp", con)
    Dim dset As New System.Data.DataSet()
    Dim da As New System.Data.OleDb.OleDbDataAdapter()
    com.Connection.Open()
    da.SelectCommand = com
    da.Fill(dset, "temp")
    Dim i As Integer
    Dim r As System.Data.DataRowCollection
    ' r is the Datarow collection helps to give track of the rows of the Dataset
    r = dset.Tables("temp").Rows
    ' equalling the r to the Dataset Rows
    For i = 0 To r.Count - 1
    'r.count the total no of Rows in the Dataset
    Dim mer As String
    mer = "Hello"
    r(i)(2) = mer.ToString()
    ' fill values in the Dataset
    MessageBox.Show(r(i)(2).ToString())
    'test the result
    Next i
    dset.Reset()
    com.Connection.Close()

    [email protected][B]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width