Click here to Skip to main content
15,911,891 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I am using the following code in VB to open access database:

With objAcc
        .OpenCurrentDatabase App.Path & "\SerialTagging.accdb", True, "pass123"
        .DoCmd.TransferText acExportDelim, , "FinalOutput", App.Path & "\Output\BOSS_SN_MCC.csv", -1
        .CloseCurrentDatabase
 End With


I want to convert the same For SQL Server database..

Any help or suggestion would be greatly appreciated.

Regards,
Raj
Posted
Comments
Prerak Patel 30-Aug-11 2:46am    
You cannot convert the same code for SQL server. You are using Access.Application object which cannot be used with SQL database.

1 solution

You need to use OledbConnection[^] or SqlConnection[^]
Check connection strings here[^].
 
Share this answer
 
Comments
Raj.rcr 30-Aug-11 3:17am    
Thank you.. But, do I need to remove the following statement from the application?

Dim objAcc As New Access.Application
Prerak Patel 30-Aug-11 3:27am    
You have to. Check the samples in the given link and try to convert.
Raj.rcr 30-Aug-11 4:33am    
I am trying a lot by following the links you have furnished.. But, I am not able to make it work for sql server.. plz guide me if u can
Prerak Patel 30-Aug-11 7:03am    
Show the code how you are trying it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900