Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VB Script Connection to SQL Server

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1794
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Script Connection to SQL Server
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VB Script Connection to SQL Server - 1/6/2005 2:15:11 AM   
  nathans

 

Posts: 10
Score: 0
Joined: 12/6/2004
From:
Status: offline
Hi,

I have recently learnt how to use SQL Server. However the purpose of me learning this was to make the database under my web site a SQL server one, and not MS Access.

Can anyone advise on a good website for learning VB Script connections to SQL Server. Previously i used ADO connections to my Access ones.

Many thanks

Nathan.
 
 
Post #: 1
 
 Re: VB Script Connection to SQL Server - 1/6/2005 2:46:31 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Connect same way

' Specify connection string. This is an SQL server database on server
strConnect = "DRIVER=SQL Server;Trusted_Connection=No;DATABASE=YourDatabase;SERVER=ServerName"

' Setup Recordset object and connect to database.
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.ActiveConnection = strConnect

' Assign T-SQL statement to Source property.
adoRecordset.Source = "SELECT Field1,Field2,Field3 FROM YourTable WHERE Field4="
' Run the query and return a recordset.
adoRecordset.Open

(in reply to nathans)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB Script Connection to SQL Server Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts