Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004

    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.

  2. #2
    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.

  3. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts