all groups > asp.net security > october 2007 >
You're in the

asp.net security

group:

How to test a asp connection to mysql?



How to test a asp connection to mysql? David
10/20/2007 11:22:37 PM
asp.net security: Have just installed mysql on to my server

Does anyone know of a sample test script that will test if asp can connect
to a test databse?.

I just want to find out if it is working.

thanks

Re: How to test a asp connection to mysql? Alexey Smirnov
10/25/2007 6:09:00 PM
[quoted text, click to view]

David, I think you're in the wrong group

MySQL.aspx

<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">

Sub Page_Load(sender As Object, e As 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(strSQL, myConnection)
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>
Re: How to test a asp connection to mysql? David
10/25/2007 8:20:31 PM

[quoted text, click to view]
snip


thank you Alexey

AddThis Social Bookmark Button