TurfSite Web Services
Please Login or Register

Knowledgebase

Do you have a connection string I can use to connect to the local MSSQL database?

Yes. Please use the following connection string and fill in the necessary spots with your database's information:

<add name="strConn" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=DBNAME;Integrated Security=false;User ID=DBUSERNAME;Password=DBPASSWORD" />

DBNAME is what you specified as your database name in the control panel
DBUSERNAME is the username you created to connect to the database (and was associated with the database in the control panel)
DBPASSWORD is the password you associated with the username above

An example script:

<%@ Import Namespace="System.Data.SqlClient" %>
<%
Dim conn As SqlConnection
Dim sqlQuery As SqlCommand
Dim dtrTbl As SqlDataReader
conn = New SqlConnection( "Server=localhost\sqlexpress;uid=USERNAME;pwd=PASSWORD;database=DBID" )
conn.Open()
sqlQuery = New SqlCommand( "Select COLLUMN_NAME From TABLE_NAME", condDBID)
dtrTbl = sqlQuery.ExecuteReader()
While dtrTbl.Read()
Response.Write(“<li>" )
Response.Write(dtrTbl( "COLUMN_NAME" ) )
End While
dtrTbl.Close()
conn.Close()
%>



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article


Powered by WHMCompleteSolution

Quick Navigation

Client Login

Email

Password

Remember Me

Search