The Connection Is Dead - ODBC

G

Guest

Hello,

I am having a problem getting data from a MySQL database using an ODBC
connection. The below code
works 100% in a Windows Form but not in my ASP.Net Web Form. It returns the
error "The Connection
Is Dead" at the oDBA.Fill line.

I have MySQL's MyODBC drive version 3.51.09 on the server which is the latest.

Any suggestions or help? Am I missing a command (like you have to use
DataBind on a WebForm but not
on a Windows Form)?


string sSQL;

sSQL = "SELECT FilePath, FileName, FileExt, " +
"Document_Name, Revision, Sheet_Name " +
"FROM Document_Locations " +
"WHERE File_ID = " + sTIFID + ";";

string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=cochise;" +
"DATABASE=ISTAR;" +
"UID=root;" +
"PASSWORD=;" +
"OPTION=3";

OdbcConnection myConnection;
OdbcCommand myCommand;
OdbcDataAdapter oDBA;
DataSet dsRecords = new DataSet();

myConnection = new OdbcConnection(MyConString);
myCommand = new OdbcCommand(sSQL, myConnection);
oDBA = new OdbcDataAdapter(myCommand);
oDBA.Fill(dsRecords);
myConnection.Close();

Thanks,
Kevin
 
G

Guest

I suppose it is not a requirement. I usually like to keep inside the box and
not get 3rd party tools. I am willing though. But that really doesn't
answer the question. Why would it work in Windows Forms but not Web Forms?
 
C

Chris Botha

If you get this problem while testing on the same machine (Windows Form and
the Web Form) then it is a security issue. From the Windows form you connect
as the logged on user, from the Web form as the anonymous user.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top