By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Connectivity with SQL and VB

P: 2
How do I solve connectivity problem with SQL and VB?
Please reply briefly with code
Sep 12 '07 #1
Share this Question
Share on Google+
4 Replies


P: 2
How do I solve connectivity problem with SQL and VB?
Please reply briefly with code
What do I use for above this ADO or DAO and how?
Sep 12 '07 #2

debasisdas
Expert 5K+
P: 8,127
Kindly use the search box on the top right corner of your page.

You will get a lot of them here.
Sep 12 '07 #3

P: 49
Hi,

Open a new project, Select Project---> References---> check the Active X Objects latest version.

Then

Declare connections, Recordsets etc...

Example. for MS-Access(Assume that student name, address fields only in the table)

form_load()

Dim dbcon as adodb.connection
Dim dbres as adodb.recordset
Dim dbsql as string

set dbcon=new adodb.connection

with dbcon
.CONNECTIONSTRING="PROVIDER=MICROSOFT.Jet.oledb.4. 0;data source=x:\Student\studentlist.mdb" ' (space between data source)
.open
end with

dbsql="select * from student"

set dbres=new adodb.recordset

dbres.open dbsql,dbcon,adopendynamic,adlockbatchoptimistic

text1.text=dbres.fields(0)
text2.text=dbres.fields(1)
Sep 13 '07 #4

hariharanmca
100+
P: 1,977
How do I solve connectivity problem with SQL and VB?
Please reply briefly with code

Expand|Select|Wrap|Line Numbers
  1. strSQLCONNECTION = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=strUserName;password=strPassword;Initial Catalog=strInitialCatalog;Data Source = strDataSourceName"
I think this will help you.
Sep 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.