[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

RE: Microsft Text Driver error - HELP

Sharique

3/6/2006 8:42:00 PM

Hi I am getting the same error for the following code. Please advise how to solve this problem

The Error message:
'conn.ServerVersion' threw an exception of type
'System.InvalidOperationException' and the conn state is closed.,


string strConn = "Password=MyPwd;User ID=MyUser;Initial Catalog=MyDB;Data Source=MyServer";
SqlDataAdapter dataAdapter;
SqlCommand cmd = new SqlCommand();
DataSet dataSet = new DataSet();
using (SqlConnection conn = new SqlConnection(strConn))
{
PrepareCommand(cmd, conn, null, CommandType.StoredProcedure, "MySp", null);
dataAdapter = new SqlDataAdapter(cmd);
dataAdapter.Fill(dataSet);
cmd.Parameters.Clear();
//return dataSet;
}

Posted via DevelopmentNow.com Groups
http://www.developm...