Results 1 to 2 of 2

Thread: the connection string property has not been initialized

  1. #1

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    the connection string property has not been initialized

    in one of my classes i have a private function, which sets connection
    other public shared functions call this connection

    when i try to call the public shared functions say to my form code i get that error

    any one ever had that before

  2. #2
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: the connection string property has not been initialized

    make sure that the SQLCommand object's connection property is set to the SQLConnection object:

    Code:
    string connString = "blah"; //insert REAL conn string here
    SQLConnection theConnection = new SQLConnection(connString);
    SQLCommand theSQLCommand = new SQLCommand();
    theSQLCommand.Connection = theConnection; //This line
    ..
    ..

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