Click here to Skip to main content
15,911,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I create the module "mod_conn" & create function getconnect() & the following coding given in that function


Public Function getconnect()
connection = New SqlConnection("Provider=Microsoft OLE DB Provider for SQL Server Data Source=VINAYAK-67DE19C\SQLEXPRESS;Initial Catalog=UA;User ID=sa password=sulos";)
End Function

But it is not pull data from the sql database
Posted

Try adding a ';' after your UserID!

(BTW: Don't post user id and password to forums! It's a good idea to get into the habit of security: Rule 1 - never tell the whole world your password... :doh: )
 
Share this answer
 
You dont need Provider name for SqlClient as it connects to the Sql Server provider by default.

So your Connectionstring should be
"Data Source=VINAYAK-67DE19C\SQLEXPRESS;Initial Catalog=UA;User ID=sa;password=sulos;"

Change it with yours, and try to use
connection.Open() to open the connection, I hope it will be working.

Cheers
 
Share this answer
 
Just opening a connection is not going to pull the data for you.
You need to use a dataset or datareader.
 
Share this answer
 
i use this code to connect to my database

VB
Dim path As String
        path = IO.Path.GetFullPath("items.mdb")
        cnstr = "provider=microsoft.jet.oledb.4.0;data source=" & path & ";persist security info = true"
 
Share this answer
 

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