Mysql connector/net version 5.0.9 is configured at Grabweb windows servers. You may check the connectivity by uploading the below test script example in your httpdocs folder. You need to create the new database and enter the details in that below script.
Create the table in the newely created database :-
CREATE TABLE `verse` (`verse_id` int(10) unsigned
NOT NULL auto_increment,`verse_text` varchar(1024)
NOT NULL default '', `verse_ref` varchar(50) NOT NULL default '',
PRIMARY KEY (`verse_id`)
)
Insert the following text in your database from mysql commmand prompt before uploading the script page:-
INSERT INTO `verse` (`verse_text`,`verse_ref`) VALUES ('And God is able to
make all grace abound to you, so that in all things at all times, having
all that you need, you will abound in every good work.','2 Corinthians 9:8'),
('Whatever you do, work at it with all your heart, as working for the
Lord, not for men, since you know that you will receive an inheritance from
the Lord as a reward. It is the Lord Christ you are serving.',
'Colossians 3:23-24');
Create the following test script page to check the working of the Mysql/connector net :-
<%@ 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=database_username; password=database_password; database=database_name; pooling=false;")
strSQL = "SELECT * FROM verse;"
myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
myDataSet = New Dataset()
myDataAdapter.Fill(myDataSet, "verse")
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>
Upload the above script in the httpdocs folder of your website and check by running the URL in the web browser. You need to run the following URL :- http://your-domain.com/scriptname.asp.
