Why do I get the error message ‘Value cannot be null. Parameter name: dataSet ‘
The cause of this error may be that you have declared a dataset but have not written the following statement VB.NET ds= new DataSet() C# ds= new DataSet();
Why do I get the error message ‘There is already an open DataReader associated with this Connection which must be closed first.’
This is caused if you are attempting to use the same DataReader more than once in your code without closing the previous Datareader. Or you might have a DataReader open on the same connection as the DataAdapter/Command uses. So it is not recommended to share a connection between a DataReader and a DataAdapter/Command Either close the first connection or, if you must keep it open as you are executing another reader from within it, use another connection object.
Why do I get the error message ‘ExecuteReader: Connection property has not been initialized’
This error is caused if there is no Connection object associated with the Command Object. To resolve this VB.NET Dim cn as new SqlConnection(‘<your connection string>’) ’Dim cn as new OleDbConnection(‘<your connection string>’) Dim cmd As new SqlCommand(‘Select * from Products’, cn) ’Dim cmd As new OleDbCommand(‘Select * from Products’, cn) C# SqlConnection cn = new SqlConnection (‘<your connection string>’); ’OleDbConnection cn = new OleDbConnection (‘<your connection string>’); SqlCommand cmd = new SqlCommand (‘Select * from Products’, cn); ’OleDbCommand cmd = new OleDbCommand (‘Select * from Products’, cn);
I get the error message ‘Keyword not supported: ‘provider”, when using Sql Server why?
If you are using SqlConnection then the connection string should be as follows: server=localhost;uid=sa;password=;database=northwind i.e server=<yourservername>;uid=<youruid>;password=<yourpassword>;database=<yourdbName>’ For SqlConnection we do not provide a Provider . Provider is used in cases where OleDbConnection is used.
Why do I get the error message ‘The ConnectionString property has not been initialized’
Check if you have specified the connection string VB.NET dim cn as new SqlConnection(‘<your connection string>’) ’dim cn as new OleDdConnection(‘<your connection string>’) C# SqlConnection cn = new SqlConnection(‘<your connection string>’); OleDbConnection cn = new OleDbConnection(‘<your connection string>’);