remote db db connection

hello there,

can you please give me a simple asp.net code. so i can test my website db connection.

cheers
ZOlf
zolfAsked:
Who is Participating?
 
Gyanendra SinghConnect With a Mentor ArchitectCommented:
error suggest server address is not correct or username through you are trying to connect is not correct .. please check
0
 
smokingspacemanConnect With a Mentor Commented:
Assuming you're using SQL server;
    Public Function select(ByVal sqlQuery As String)
        Dim dataset As New DataSet
        Try
            Dim Connection As SqlConnection
            Connection = New SqlConnection(Data Source=computer\SQLEXPRESS;Initial Catalog=table;User ID=x;Password=y)
            Dim adapter As New SqlDataAdapter
            adapter.SelectCommand = New SqlCommand(sqlQuery, Connection)
            adapter.Fill(dataset, "temp")
        Catch ex As Exception
        End Try
        Return dataset
    End Function
0
 
zolfAuthor Commented:
do i just copy and paste the cope into a notepad and save it as test.aspx.and in then call it from my website
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
zolfAuthor Commented:

i just want to test connection.i dont have any table in my db now.
0
 
zolfAuthor Commented:

i tried something like this.but i get this ierror

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

/conn.asp, line 4

<%
Dim conn, rs
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB;server=<202.***.***.***>;Database=<abc>;uid=<eawj>;pwd=<****>"
set rs = Server.CreateObject("ADODB.RecordSet")
%>
0
 
zolfAuthor Commented:

the db is not on my computer.i am trying to connect to my hosting's db
0
All Courses

From novice to tech pro — start learning today.