Solved

Can I read data from sql server using vbscript?

Posted on 2008-09-30
2
1,550 Views
Last Modified: 2012-05-05
I'm just getting started with script programming and want to verify that I can use vb script to read data from sql server.  I am testing by trying to open the 'pubs' database.  

on error resume next
'msgbox "start"
Set con = CreateObject("ADODB.Connection")
constring = "Provider=SQLOLEDB.1; Data Source=mydatasource; Initial Catalog=Pubs; user id = sa; password=''"
con.open = constring
msgbox err.description
msgbox "end"

I get the error "SQL Server does not exist or access denied".
Should this work?
0
Comment
Question by:utahalee
2 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 50 total points
ID: 22605799
If you have no password, you don't need two single quotes at the end ''.  Also, please don't tell me that your SA account has no password.

Also, remove the spaces before and after the = in user id.  
0
 

Author Closing Comment

by:utahalee
ID: 31501632
There is no sql administrator.  They have one app that was written by a contractor a few years ago.  They have no programmer, no database administrator,  just 1 network person for the whole it dept.  This app is completely unsupported.  I work partime as the it asst.  I have done lots of visualstudio vb programming and have been asked to try to do some reporting from the database.    There is no one here who know anything about sql server except that it is being used.  I'm not a dql server administrator so I'm taking "educated" guesses on the connection string.  I'm testing with the pubs.  it has an "sa" user which I'm guessing has no password but not sure.   My main question was that I wanted to be sure that I could could us vb script like in my example and make a connection which I did not hear you say won't work.  Its a mess trying to figure out what do use because noone here knows how it works,  Just getting a connection will be a giant leap.  Thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with query 3 23
SQL Syntax 5 33
Sql server insert 13 26
sql server computed columns 11 29
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now