|
|
Subject:
C# .NET 2.0 NullReferenceException
Category: Computers > Programming Asked by: valamas-ga List Price: $2.00 |
Posted:
01 Aug 2005 20:21 PDT
Expires: 01 Aug 2005 21:07 PDT Question ID: 550650 |
C# .NET 2.0 whats wrong with my code please? I get an error on the second line saying "NullReferenceException was unhandled by user code" - "Object reference not set to an instance of an object." 01 string sql = "select * from myTable"; 02 DataTable dtStructure = MyDatabase.ExecuteDataTable(sql); here is my function in another class, DAL.Database public DataTable ExecuteDataTable(string sql) { // Conn and Cmd are publics Cmd.CommandType = CommandType.Text; Cmd.CommandText = sql; SqlDataAdapter sqlAdapter = new SqlDataAdapter(Cmd); DataTable dt = new DataTable("myTable"); sqlAdapter.Fill(dt); //close our connection Conn.Close(); //return our DataTable return dt; } |
|
There is no answer at this time. |
|
There are no comments at this time. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |