HighTechTalks DotNet Forums  

Problem with an ODBCConnection when using it in a WebService.

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss Problem with an ODBCConnection when using it in a WebService. in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jonathan Sauvé
 
Posts: n/a

Default Problem with an ODBCConnection when using it in a WebService. - 07-09-2003 , 04:13 PM






Hi all,

I am having a problem with the ODBCConnection class when trying to open
a connection to my Paradox table in my WebService. When using it in a
normal windows app, it goes perfectly, but when using it in a WebService
context, it gives me the error : [System.NullReferenceException] {"Object
reference not set to an instance of an object." }
System.NullReferenceException.

Here is the code:

OdbcConnection cnnHist = new
OdbcConnection("Dsn=MyDSN;pwd=ThePassword;Exclusiv e=False;");
try
{
string Name = WindowsIdentity.GetCurrent().Name;
cnnHist.Open();

if (cnnHist.State == ConnectionState.Open)
{
//Add validation of the first row Datetime.

OdbcCommand cmd = new OdbcCommand("Select * from \"History\" Where MasterK
= ? ", cnnHist);
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add("MasterK", OdbcType.Int);
cmd.Parameters["MasterK"].Value = piMasterKey;
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
result = new DataSet();
da.Fill(result, "HistoricalDataByDay");
}
}
catch (Exception e)
{
throw e;
}
finally{cnnHist.Close();}

I assured myself that the current WindowsIdentity is the same (IE
impersonnate if necessary), so that is not the problem.

Any idea

Thanks

Jonathan



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.