Hi,
I am a asp-beginner and i am trying to connect mysql database via my
asp file but i cann't. I have installed mysql 4.1 and connector/odbc
3.51 .
i have tryed with two file one normal asp and another an asp.net
asp-file:
<html>
<!-- #INCLUDE file="dbKurf.inc" -->
<%
set adoConn = Server.CreateObject("ADODB.Connection")
'adoConn.Open "Driver="&dbDriver&"; Database="&dbDatabase&";
Uid="&dbUser&"; Pwd="&dbPass&";"
adoConn.Open "Driver={mySQL}; Server=localhost; Port=3306; Option=0;
Socket=; Stmt=; Database=kurf; Uid=root; Pwd=rishakawwemana;"
set adoRS = Server.CreateObject("ADODB.Recordset")
adoRS.ActiveConnection = adoConn
if adoConn.errors.count = 0 then
response.write "<h2>Fields In The 'diwan' Table:</h2>"
else
response.write "not connected"
end if
%>
</html>
when i drive http://localhost/mytest.asp i got following error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/databas/kurfTest.asp, line 7
------------------------------------------
and here is my asp.net file:
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 myodbc
Dim myDataAdapter As MySqlDataAdapter
Dim myDataSet As DataSet
Dim strSQL As String
Dim iRecordCount As Integer
myConnection = New MySqlConnection("server=localhost; user
id=root; password=rishakawwemana; database=kurf; 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>
in this case i got following error:
Compiler Error Message: BC30002: Type 'myodbc' is not defined.
thank you so much for your help.
my mail: [EMAIL PROTECTED]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/