View Full Version : DSN in Webservice
rohit
05-08-2003, 02:27 AM
Hello evreybody
I would like to know how to use DSN to access my database.
and where do i need to create the DSN.. in webserver system or client
system
thank you,
bye
bruce
05-08-2003, 07:38 AM
Are you referring to ASP.net WebService?
For ASP.net page (regular or webservice), you should use OleDB provider rather than ODBC DSN. OleDB provide better performance.
Sample connection to Access DB
Dim mySelectQuery As String = "SELECT * FROM tblContact"
Dim myConnection As New oledbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/test.mdb"))
Dim myCommand As New oledbCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As oledbDataReader = myCommand.ExecuteReader()
Try
While myReader.Read()
response.write (myReader("firstname") & "
")
End While
Finally
' always call Close when done reading.
myReader.Close()
' always call Close when done with connection.
myConnection.Close()
End Try</font id="Courier New">
[b]quote:Originally posted by rohit
Hello evreybody
I would like to know how to use DSN to access my database.
and where do i need to create the DSN.. in webserver system or client
system
thank you,
bye
</blockquote id="quote"></font id="quote">
vBulletin® ©Jelsoft Enterprises Ltd.