Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 connecting on sql server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-11 : 10:28:56
shaimaa writes "i have a problem when connecting on the sql server using vb code
my connecting code is:
Dim connectionstring As String
connectionstring = "Provider=SQLOLEDB;Data Source=C:\programs\sqlserver\MSSQL\Data\pqi_db_data.mdf;Initial Catalog=pqi_db;username = sa; password = "" Connect Timeout=30;"
Dim myconnection As New OleDbConnection(connectionstring)
Dim mycommand As New OleDbDataAdapter("select * from courses", myconnection)
Dim ds As DataSet = New DataSet()
mycommand.Fill(ds, "courses")

the error is:
Format of the initialization string does not conform to the OLE DB specification
and line "mycommand.Fill(ds, "courses")" is marked to be the line of error
if you dont mind i want you to explain this problem in details
thanks"

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-11-11 : 18:45:47
In your connection string, DataSource should be the name of your server or the name of your instance DataSource=SERVERNAME or DataSource=SERVERNAME\INSTANCENAME. Have a look at
[url]http://www.able-consulting.com/dotnet/adonet/Data_Providers.htm#SQLClientManagedProvider[/url]


HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -