Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 11249599

@User 11249599
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Setting an instance object equal to my empty string.
    U User 11249599

    I can't explain it properly in the subject section, it's not as simple as that. Here is the code snippet in question.

    UserPass = reader["Password"].ToString();

    So UserPass is my string variable and reader is an SqlReader object. Here is it being instantiated:

    SqlDataReader reader = myCommand.ExecuteReader();

    (myCommand is an SqlCommand obj)

    reader["Password"]

    Password is a column name in my Sql DB. Basically I've just told the reader to go look within that column and used a query to specify where abouts. I want to set the reader["Password"] equal to an empty string to compare against user input. Now there aren't any errors when I do this but it does throw an exception:

    An exception of type 'System.InvalidOperationException' occurred in System.Data.dll but was not handled in user code

    It doesn't give much more detail other than that and I'm not entirely sure what's wrong.

    C# database question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups