Thursday, March 22, 2012

A very basic Q

This is probably a very silly question.I started learning ASP.net by following ASP.NET Unleashed. I am stuck where he wants me to open a connection to SQL Server database. I have just downloaded
MSDE. But I dont know where to type this code and how to run it..so as to connect to the database.

<%@. Import Namespace="System.Data.SqlClient" %
<Script Runat="Server"
Sub Page_Load
Dim conPubs As SqlConnection

conPubs = New SqlConnection( "server=localhost;uid=webuser;pwd=secret;database=pubs" )
conPubs.Open()
End Sub

</Script>


Connection Opened!

Now do i have to change the uid to SA ? (i had to assign one when i downloaded and installed MSDE?

Thanks for the help.when you installed your instance of msde- did you use the username SA or did you use the username webuser?

if you used the username webuser- then you have done just fine...

No comments:

Post a Comment