Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:03:21+00:00 2026-06-01T07:03:21+00:00

I am having trouble SELECTing a column of type uniqueidentifier and putting it in

  • 0

I am having trouble SELECTing a column of type uniqueidentifier and putting it in a variable of type Guid in ASP.net.

The database is generating the uniqueidentifier, and all I want to do is pull them out and store the values in case I need to populate a foreign key table.

I am using a private member to store the value:

Private _uniqueID as guid

I SELECT from the table and use a SqlDataReader called vRdr. All the other values are coming out just fine, but when I add this I get an error:

if not isDBNull( vRdr("uniqueID")) then
    _uniqueID =  vRdr.GetGuid("uniqueID")
end if

The error I get is

Input string was not in a correct format.

I am not sure why I am having so much trouble trying to select these values. I have also tried Guid.Parse() and Guid.TryParse() on the data reader value with no luck.

Thanks for reading.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:03:23+00:00Added an answer on June 1, 2026 at 7:03 am

    According to the MSDN docs, GetGuid() takes a column ordinal, not a string key. Change your code to this:

    _uniqueID =  vRdr.GetGuid(vRdr.GetOrdinal("uniqueID"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble selecting the root of the solution in my ASP.NET Application. I
We are using asp.net mvc and having trouble in selecting the list of approved
I'm having trouble selecting all contents of the div. Here's a demo: http://jsfiddle.net/KcX6A/304/ It's
Possible Duplicate: select all checkboxes command jquery, javascript I am having trouble selecting all
I am having major trouble selecting the most current/matching row in my database. For
I am having trouble efficiently selecting the information I need to display. Hopefully someone
I am having trouble with a slowly changing dimension type II selection. I am
Hey guys, working on an event calendar. I'm having some trouble getting my column
I am having trouble selecting an item from a Javascript dropdown (i.e. the items
I am having trouble selecting a hidden form field value that is a part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.