none
what's wrong of my code which create a connect to SQL server RRS feed

  • Question

  • i write in VC2008 ,i use the following code :

       sqlst->DataSource:: set("server");
       sqlst->InitialCatalog:: set("test");
       sqlst->UserID:: set("sa");
       sqlst->Password:: set("1234");
       conn=sqlst->ToString();
       sql->ConnectionString:: set(conn);
       sql->Open();

     

     

    BUT compile says that

    An unhandled exception of type 'System.NullReferenceException' occurred in System.Data.dll

     

    what's wrong?

    i already defined :

     private: System:: Data:: SqlClient:: SqlConnection^ sql;
     private: System:: Data:: SqlClient:: SqlConnectionStringBuilder^ sqlst;

     private: System:: string^ conn;
     

    Saturday, December 8, 2007 12:17 AM

All replies