hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : My SQL Connection Sample Code

Forum Jump

My SQL Connection Sample Code

Reply Post New Thread In Hosting Security and Technology Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
Retired Moderator
Join Date: Mar 2004
Location: Singapore/Melbourne
Posts: 6,890

My SQL Connection Sample Code

Anyone has sample code for calling MySQL connection in ASP. After calling maybe just display a "Tested Connection Working" or something like that?

Some sort of script is best to test my clients' connection codes.

Sponsored Links
Web Hosting Master
Join Date: Jul 2004
Posts: 928
I think this might be what ya want.
PHP Code:
 <%@ Page Language="VB" debug="true" %>
Import Namespace = "System.Data" %>
Import Namespace = "MySql.Data.MySqlClient" %>
script language="VB" runat="server">

Sub Page_Load(sender As ObjectAs EventArgs)

Dim myConnection  As MySqlConnection
    Dim myDataAdapter 
As MySqlDataAdapter
    Dim myDataSet     
As DataSet

    Dim strSQL        
As String
    Dim iRecordCount  
As Integer

= New MySqlConnection("server=localhost; user id=15secs; password=password; database=mydatabase; pooling=false;")

strSQL "SELECT * FROM mytable;"

myDataAdapter = New MySqlDataAdapter(strSQLmyConnection)
myDataSet = New Dataset()

MySQLDataGrid.DataSource myDataSet

End Sub


<title>Simple MySQL Database Query</title>

<form runat="server">

<asp:DataGrid id="MySQLDataGrid" runat="server" />



Last edited by Criminal#58369; 08-29-2005 at 01:05 PM.

Related posts from
Title Type Date Posted
Canadian Man Faces New Charges in Heartbleed Canada Revenue Agency Breach Web Hosting News 2014-12-05 11:42:31
London Teen Charged in Connection with Massive Spamhaus DDoS Attacks Web Hosting News 2014-06-30 12:45:23
Web Host Code Spaces Closes Shop After Hacker Deletes Customer Data Web Hosting News 2014-06-19 16:34:41
Web Hosting Sales and Promos Roundup - May 2, 2014 Web Hosting News 2014-05-23 16:54:17
Free Registration with the WHIR Coupon Code Blog 2014-01-30 13:24:20

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?