hosted by liquidweb


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

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
  #1  
Old
Retired Moderator
 
Join Date: Mar 2004
Location: Singapore/Melbourne
Posts: 6,852

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
  #2  
Old
Web Hosting Master
 
Join Date: Jul 2004
Posts: 928
I think this might be what ya want.
http://www.15seconds.com/issue/050407.htm
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

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

    
strSQL "SELECT * FROM mytable;"

    
myDataAdapter = New MySqlDataAdapter(strSQLmyConnection)
    
myDataSet = New Dataset()
    
myDataAdapter.Fill(myDataSet"mytable")

    
MySQLDataGrid.DataSource myDataSet
    MySQLDataGrid
.DataBind()

End Sub

</script>

<html>
<head>
<title>Simple MySQL Database Query</title>
</head>
<body>

<form runat="server">

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

</form>

</body>
</html> 


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

Related posts from TheWhir.com
Title Type Date Posted
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 WHD.global Registration with the WHIR Coupon Code Blog 2014-01-30 13:24:20
Web Hosting Sales and Promos Roundup - October 4, 2013 Web Hosting News 2014-05-23 15:42:45


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
Login:
Log in with your username and password
Username:
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.

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com 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?