Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Connect to SQL DB


Reply
 
Thread Tools Display Modes
  #1  
Old 12-09-2005, 02:55 AM
Grifter's Avatar
Grifter Grifter is offline
Centurion
 
Join Date: Jan 2004
Posts: 104
Unhappy Connect to SQL DB


Ok, this is probably a real noobie question but its twisting my head.

So far I have only ever used access databases with my code. However I now have a task that involves our SQL server databases.

For this reason I decided to use the "Data Form Wizard" to give me a good starting point.

I created an ODBC connection to the DB...which tests out successfully.

The data form wizard see the database...sees the tables....which then lets me select the fields from the table to use....all looking good so far....

but when I try to Run the resulting form i get an "Invalid Object Name" for the tablename I selected.

code as below. - modified the SQL statement for privacy and ease of read.

Code:
db.Open "PROVIDER=MSDASQL;dsn=SQLAdv;uid=admin;pwd=password;database=DBname;" Set adoPrimaryRS = New Recordset adoPrimaryRS.Open "select * from table1 Order by LoginName", db, adOpenStatic, adLockOptimistic

now this error is fumbling me....because obviously the table exists and works as the data form wizard lets me select it.

Thanks in advance for advice. This is probably something dead simple that I missed
__________________
"The one with the most toys at death....WINS!"

"My girlfriend is a real high performance woman........goes from 0 to headache in 6 seconds".....AKA the time it takes me to ask her if she's up for it
Reply With Quote
  #2  
Old 12-09-2005, 04:35 AM
KnooKie KnooKie is offline
Senior Contributor
 
Join Date: May 2003
Location: London
Posts: 802
Default

bit of a guess but have you got the following line somewhere...

Dim adoPrimaryRS as New ADO.Recordset
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->