Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Translate DSN to SQL String connection


Message #1 by <mjsimoes@m...> on Tue, 5 Feb 2002 00:13:08 -0000
This is a multi-part message in MIME format.



------=_NextPart_000_0008_01C1ADD9.E421E6A0

Content-Type: text/plain;

	charset="us-ascii"

Content-Transfer-Encoding: 7bit



In the sample aplication "portalVB"

(http://www.gotdotnet.com/quickstart/aspplus/samples/portal/VB/default.a

spx ) there's a login page (module login.vb) that referes to a

connection to a SQL server (portaldb) :

.............

Try

      Dim hshTable as NameValueCollection 

CType(Context.GetConfig("system.web/dsnstore"), NameValueCollection)

      Dim dsn as String = CType(hshTable.Item("portaldb"), String)



      Dim myCommand as SqlCommand = new SqlCommand()

      myCommand.Connection = new SqlConnection(dsn)

      myCommand.Connection.Open()

      myCommand.CommandText = "sp_ValidateUser"

      myCommand.CommandType = CommandType.StoredProcedure

..

.........

 

If I want to use a SQL String connection like the one  " myConnection 

New SqlConnection _( "server=localhost;uid=sa;database=Pubs") what do I

have to change in the above code?

 

Thanks in advance,

 

Miguel Simoes

Lisboa - Portugal







  Return to Index