Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SQLHelper.ExecuteDataset

Author  Topic 

devinev
Starting Member

16 Posts

Posted - 2006-08-29 : 14:03:39
I am having a problem accessing an sql database from a web appplication using the subject application block. The code is as follows:

storedParams(0).value = strPID
dim dsProject as dataset = new dataset
dsProject = Sqlhelper.ExecuteDataset(connstring,CommandType.Text,query,storedParams)

I get an exception with the message = "SQL Server does not exist or access denied"

I know the connection string is good because it is used successfully throughout the application. I have gone into the database and given the user in the connection string all the permissions possible for the database in question.

Can anybody throw any light on what is going on?

Thanks,

devine1

dfiala
Posting Yak Master

116 Posts

Posted - 2006-08-29 : 14:25:37
If your network is set up properly and you can otherwise access the database, this is because you have a bad connection string.

If you are sure you have a good connection string, make sure

connstring

is holding the value you think it is.

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-08-29 : 14:46:00
Also make sure that you really need a DataSet .... I hate ExecuteDataset. So many people create full datasets when most of they time all they really need is a DataReader (or, at most, a DataTable) ....

- Jeff
Go to Top of Page

devinev
Starting Member

16 Posts

Posted - 2006-08-30 : 10:07:41
Thanks for your inputs.
I have double checked the connection string and it looks the same as it does for the preceding SQL queries. Does there have to be any additional information besides server, uid, password and Initial Catalog for SQLhelper.ExecuteDataset? The preceding queries are of the SQLhelperparametercache.GetCachedParameter type.

I also tried changing from a dataset to a datareader but get the same results.
This is not my code - I am trying to implement somebody else's code.


Go to Top of Page

dfiala
Posting Yak Master

116 Posts

Posted - 2006-08-30 : 11:03:15
Can you connect to the database using those credentials in Query Analyzer? That's the true test.

>>SQLhelperparametercache.GetCachedParameter

looks like some hand-rolled code on top of the data access block's ParameterCache object. What version of .NET are you working in?

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page
   

- Advertisement -