If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > From ACCESS to SQL Server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-04, 13:31
Wolverchenus Wolverchenus is offline
Registered User
 
Join Date: Mar 2004
Posts: 34
From ACCESS to SQL Server

Heya all.

Currently I'm connecting to an ACCESS Database from VB with OLEDB.

I want to make my database on a SQL Server and I heard it's not that complicated.

Can someone show me at the right direction?

Thanks
Chen
Reply With Quote
  #2 (permalink)  
Old 03-10-04, 15:39
rami.haddad rami.haddad is offline
Registered User
 
Join Date: Jan 2004
Posts: 184
Re: From ACCESS to SQL Server

Yes use ADO. Here is an example using ADO (Remember to add the Microsoft ActiveX Data Objects to your project)

dim cn as ADODB.connection
dim rs as ADODB.recordset

set cn = new ADODB.connection

cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DataBaseName;Data Source=ServerName"

cn.open 'Now you have an open connection to Access

set rs = new ADODB.recordset

rs.actiiveconnection = cn

rs.open "SELECT * FROM Table1"

rs.close

cn.close

set rs=nothing
set cn = nothing
__________________
In abundance of water only the fool is thirsty. Bob Marley.
Reply With Quote
  #3 (permalink)  
Old 03-11-04, 00:04
Wolverchenus Wolverchenus is offline
Registered User
 
Join Date: Mar 2004
Posts: 34
Thanks a million!

Out of curiosity,
Is there no way to use OLEDB to connect to SQL servers?
Reply With Quote
  #4 (permalink)  
Old 03-11-04, 09:09
rami.haddad rami.haddad is offline
Registered User
 
Join Date: Jan 2004
Posts: 184
Yes you can, all the code would be the same except your connection string would change. However in the example I gave you it is OLEDB that is being used.

Provider=SQLOLEDB.1
__________________
In abundance of water only the fool is thirsty. Bob Marley.
Reply With Quote
  #5 (permalink)  
Old 03-11-04, 09:41
Wolverchenus Wolverchenus is offline
Registered User
 
Join Date: Mar 2004
Posts: 34
Thanks, you've been of great assitance.
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On