2012年3月7日星期三

first SQL conn

Hi forum, thought about time I updated from OleDB to SqlClient.

My remote host company supports MS SQL Server 2005, I have created a testsql.mdf, now I want to connect to that database,( im used to writing Access conn like below and have updated my OleDB code to Sql ).

<%@. Import Namespace="System.Data"%>
<%@. Import Namespace="System.Data.OleDb" %>

strAccessConn ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\\inetpub\\vhosts\\blablabla\\httpdoc\\App_Data\\testdb1.mdb";

How do I write the SQL connection string?

<%@. Import Namespace="System.Data"%>
<%@. Import Namespace="System.Data.SqlClient" %>

strSqlConn =?? this bit ???

This is the remote host path

LocalSqlServer

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true

This my first SQL data application so need some help thanks Paul

Check outhttp://www.connectionstrings.com/

没有评论:

发表评论