I am trying again and again to creat a connection string and can't access the DB.
I get different errors and this is the last one:
System.ArgumentException: Keyword not supported: 'provider'.
Line 9: Dim connString as string ="Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=AdultBiggest; User ID=Erez; Password=erezlevi;"
Line 10: Dim myConnection As New SqlConnection(connString)
The full test code is very simple and as the following:
<%@. Page Language="VB" Debug="true" %>
<%@. import Namespace="system.Data" %>
<%@. import Namespace="system.Data.sqlClient" %
<Script runat="server">
sub Page_Load(Sender as object, e as eventArgs)
Dim connString as string ="Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=AdultBiggest; User ID=Erez; Password=xxxxxx;"
Dim myConnection As New SqlConnection(connString)
myConnection.Open()
myConnection.close()
end sub
</Script
<HTML><BODY
</HTML></BODY
what do I do wrong?
Thanks for your help!!Hello Try This
"server=(local); database=AdultBiggest; uid=Erez; pwd=erezlevi; Network Library=dbmssocn;"|||In your connection string you have the attribute "Provider". You don't need it as you are using the .Net connection provider
try this line instead:
Dim connString as string ="Data Source=localhost;Initial Catalog=AdultBiggest;User ID=Erez; Password=xxxxxx;"|||now i am getting the following:
Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
for anyone of the above connection strings. I can connect to it just fine through an ASP page.
Thanks for your replays.|||Try it in a simpler form:
"server=(local);uid=YourUID;pwd=YourPWD;database=YourDBName"
(This DOES assume you are using SQL Server locally, on your computer, and it's not setup specifically for Windows Authentication AND you are using a UID & PWD that are correct for that SQL Server)|||Thank you all for replaying, it's working now!!
No comments:
Post a Comment