I know it can be simple to access a mysql or sql database on godaddy.. i have done it before, but now i have lost the code. Now the code that should be working just comes up with a security exception.
So how do i create a asp or aspx file on my godaddy free hosting account that will connect to a database i have already set up (mysql,sql or ms access) and simple add a value that was passed in the query string?
looking for the simplest solution here i don't care if its "asp.net,asp,aspx,html" or whatever below is what i have so far which does not work.
on my root/web.config
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
in my root/aspsqltest.aspx
<%
dim Username
dim Password
Username = Request.Form("txtUsername")
Password = Request.Form("txtPassword")
Response.Write("try")
Dim connectionString, conn, rs
Response.Write("thing 1")
connectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=syncnote2.db.6666015.hostedresource.com; DATABASE=syncnote2; UID=root; PASSWORD=sensored;"
Response.Write("thing 2")
conn = Server.CreateObject("ADODB.Connection")
Response.Write("thing 3")
conn.Open(connectionString)
Response.Write("thing 4")
rs = conn.Execute("SELECT * FROM userlogin where username='"& Username &"'")
Response.Write("sucsess")
%>
and the error is:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
Line 10: connectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=syncnote2.db.6666015.hostedresource.com; DATABASE=syncnote2; UID=root; PASSWORD=sensored;"
Line 11: Response.Write("thing 2")
Line 12: conn = Server.CreateObject("ADODB.Connection")
Line 13: Response.Write("thing 3")
Line 14: conn.Open(connectionString)
Source File: D:\Hosting\6666015\html\aspsqltest.aspx Line: 12
Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Web.HttpServerUtility.CreateObject(String progID) +45
ASP.aspsqltest_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in D:\Hosting\6666015\html\aspsqltest.aspx:12
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.aspsqltest_aspx.ProcessRequest(HttpContext context) +37
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
thank you very much for your help, my only real goal here is to be able to store a value in a database on my godaddy free hosting account.. it really should not be so hard.