Results 1 to 3 of 3

Thread: Get the GUID from a Dataset

  1. #1

    Thread Starter
    Junior Member JohannS's Avatar
    Join Date
    Aug 2001
    Location
    Pretoria, South Africa
    Posts
    21

    Get the GUID from a Dataset

    Hi There

    I've got the following problem. My Database (SQL 2000) uses Global Unique ID's as row ID's. At the moment I can retrieve these ID's with a datagrid using the datakeyfield and datakeys properties. This works great. But I now need to get the Guid of a certain row, without binding it to a datagrid first.

    I'm thinking along the lines of using a datarow, and then using one of it's properties to somehow give me the GUID for that row.

    Any ideas?
    It was an electrical problem sir, a conrod went through the block, and knocked the distributer off.

  2. #2
    Lively Member
    Join Date
    Sep 2002
    Location
    South Africa
    Posts
    88
    Why dont you give me some Coding examples of the exersize you gave me then maybe ill be able to help you
    High hopes go to all that looks down!!!

  3. #3

    Thread Starter
    Junior Member JohannS's Avatar
    Join Date
    Aug 2001
    Location
    Pretoria, South Africa
    Posts
    21

    I figured it out...

    Dim myConnection As New SqlClient.SqlConnection(Connectionstring)
    Dim myCommand As New SqlClient.SqlCommand(strSelect, myConnection)
    myConnection.Open()
    Dim Reader As SqlClient.SqlDataReader = myCommand.ExecuteReader
    Reader.Read()
    GetGuid = Reader.GetSqlGuid(0).Value
    myConnection.Close()
    myConnection.Dispose()

    Voila!
    It was an electrical problem sir, a conrod went through the block, and knocked the distributer off.

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