Hi All,
as i am new to asp.net as well oracle /mysql. i have been given a task to shift website from Oracle databse to Mysql ,i found some tools to convert databse. database converter , procedures / functions /packages copied, but facing problem to make a connection. I checked a connection string in mysql (using workbenck) in asp.net web.confic. Connection ok . but what replace with what i dont know , I need immediate help from all masters.
Here is my Mysql Test String code: web.config :
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="ictmConnectionString" connectionString="server=localhost;User Id=ictm;password=ictm;database=ictm"
providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="false" strict="false" explicit="true" />
<pages>
<namespaces>
<clear />
<add namespace="System" />
<add namespace="System.Collections" />
<add namespace="System.Collections.Specialized" />
<add namespace="System.Configuration" />
<add namespace="System.Text" />
<add namespace="System.Text.RegularExpressions" />
<add namespace="System.Web" />
<add namespace="System.Web.Caching" />
<add namespace="System.Web.SessionState" />
<add namespace="System.Web.Security" />
<add namespace="System.Web.Profile" />
<add namespace="System.Web.UI" />
<add namespace="System.Web.UI.WebControls" />
<add namespace="System.Web.UI.WebControls.WebParts" />
<add namespace="System.Web.UI.HtmlControls" />
<add namespace="System.data"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
My old (oracle )web.config
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="MM_CONNECTION_HANDLER_ictedb" value="default_oledb.htm" />
<add key="MM_CONNECTION_STRING_ictedb" value="Provider=msdaora.1;User ID=icte;Password=icte;data source=orcl" />
<add key="MM_CONNECTION_DATABASETYPE_ictedb" value="OleDb" />
<add key="MM_CONNECTION_SCHEMA_ictedb" value="" />
<add key="MM_CONNECTION_CATALOG_ictedb" value="" />
<add key="CSS_PATH" value="/icte/css" />
<add key="IMG_PATH" value="/icte/soft/tmp/" />
</appSettings>
<connectionStrings/>
Defaul.aspx
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%
Dim dbconn As OleDbConnection = New OleDbConnection(System.Configuration.ConfigurationManager.AppSettings("MM_CONNECTION_STRING_ictedb"))
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim uid, pwd As String
Dim userno, utype, lectid As Integer
uid = Trim(Request.Form("txtUid"))
pwd = Trim(Request.Form("txtUpwd"))
dbconn.Open()
cmd = New OleDbCommand("select * from UsersList where Trim(Upper(User_Id))='" & UCase(uid) & "' and Trim(User_Pwd)='" & pwd & "' ", dbconn)
dr = cmd.ExecuteReader()
If dr.Read() Then
utype = dr("User_Type")
userno = dr("User_No")
Else
userno = 0
End If
dr.Close()
dbconn.Close()
If userno > 0 Then
If utype = 2 Then
dbconn.Open()
cmd = New OleDbCommand("select * from Lecturers where User_No=" & userno & " ", dbconn)
dr = cmd.ExecuteReader()
If dr.Read() Then
lectid = dr("Lect_Id")
End If
dr.Close()
dbconn.Close()
End If
Session("user_no") = userno
Session("user_type") = utype
Session("user_id") = uid
Session("Lect_Id") = lectid
Response.Redirect("Default.aspx")
Else
Response.Redirect("home.aspx?alrvar=err&uid=" & uid)
End If
%>
And other important thing, how to manage Oracle Procedures /functions and packeges in mysql ?