473,385 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

connectivity between sql and vb

1
Hiiiiz to all guys!!!!!!!
I m new to sql server and want to open a connection between sql server and visual basic.
Can anyone help me to code connection string?
waiting 4 reply
Dec 1 '06 #1
1 6076
willakawill
1,646 1GB
Hiiiiz to all guys!!!!!!!
I m new to sql server and want to open a connection between sql server and visual basic.
Can anyone help me to code connection string?
waiting 4 reply
Hi. This works. Put in your own database and query details
Expand|Select|Wrap|Line Numbers
  1. Dim cnCon As ADODB.Connection
  2. Dim rs As ADODB.Recordset
  3. Dim strSQL As String
  4.  
  5. Set cnCon = New ADODB.Connection
  6. Set rsProbe = New ADODB.Recordset
  7.  
  8. strSQL = "SELECT blah blah blah"
  9.  
  10. With cnCon
  11.     .Provider = "SQLOLEDB"
  12.     .Properties("Data Source") = "your sql server"
  13.     .Properties("User ID") = "your user id"
  14.     .Properties("Password") = "your password"
  15.     .Open
  16.     .DefaultDatabase = "your default database"
  17. End With
  18.  
  19. With rs
  20.      .ActiveConnection = cnCon
  21.      .CursorType = adOpenStatic
  22.      .CursorLocation = adUseServer
  23.      .LockType = adLockOptimistic
  24.      .Source = strSQL
  25.      .Open
  26. End With
Dec 1 '06 #2

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

Similar topics

3
by: Alex | last post by:
I have developed a VB application that uses Oracle 8i database for backend. The database server is on the local network. From my development machine, the application connects (via ODBC) to the...
2
by: Axel Dachtler | last post by:
I am looking for detailed information about the topic "connectivity" in Oracle 9i including JDBC and CGI. Thank you
1
by: harish | last post by:
I am using java applications to connect to my MS SQL Server database. I am using ODBC for database connectivity. If i am running my java applications in a remote PC and try to connect to database...
2
by: pengfrank | last post by:
I have a 500-MB full installation CD for SQL Server 2000. All I need is to install "Client Connectivity" component (about 272K) on a bunch of workstations for users across the nation. How do I...
3
by: Omegamon | last post by:
This one should be an easy one for the community. What sort of PC client software do I need for connectivity to a DB2 database? It appears DB2 Connect is special for PC/Unix Connectivity to...
3
by: junaid | last post by:
Hi to all, Can it is possible to connect to the databse like postgre or mysql through a C programm? I know the basics of C and I have developed a small program which uses a file for the...
3
by: Niks | last post by:
Hi, I need to connect to SQL server Database using a System DSN. Can anyone tell me how to connect to SQL Server using DSN in ASP.NET (VB.Net). Using a Try Catch block. Does anyone know how to...
1
by: Darren McDowell via .NET 247 | last post by:
I have a situation, I was wondering if someone could help me. Wehave a .net web service, it runs several transactions in sqlserver 2000. We have several clients which connect to this webservice in...
1
by: lovkeshanand | last post by:
Dear All, I am using the oracle transparent gateway connectivity with sql server using tg4msql,as far as settings are concerned those were set and Connectivity is working Fine, and getting the...
1
by: ohs | last post by:
Apologies for cross posting but I can't figure where to post. Please feel free to move my message elsewhere (notify mat<at>oldhallsoftware<.>com) cheers I have an ASP.net app that mobile...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.