Guest Indiana92 Posted November 9, 2005 Share Posted November 9, 2005 Situation: in an ASP page i have created i read a table and i display an ID from the table then i have a button and when i click on a run a new query and then the window has to be closed. (This page is an example page made it to specify my problem)The problem: when i click the button the btnsave_onclick proc is executed but if i insert the commands to open my table it is non completely executed. If i leave only a msgbox("HELLO") and a window.close commands there are non problem. If i insert all the rows to create a connection i don't see the msgbox("HELLO"); another problem is that i have set some Application variables in Global.ASA and normally i can read them from vbscript code buto in this proc i can't read them. Where is my error ?I put my asp page code.Thanks in advance for help. <script LANGUAGE="vbscript">Sub btnsave_onclickdbconn = CreateObject("ADODB.Connection") ' from here commands are not executed'and variables are non readdbconn.ConnectionString = "Provider=VFPOLEDB;Data Source=c:\inetpub\wwwroot\acut\database\Aupd\;Collating Sequence=Machine"dbconn.Open "",""'dbConn.ConnectionString = Application(Aupd_connectionstring")'dbconn.Open Application("dbconn_RuntimeUserName"),Application("DbConn_RuntimePassword")SQLQuery= "Select * From Usrs" msgbox("HELLO")window.CloseEnd Sub</script><%cId = Request.QueryString("Id")Set dbconn = Server.CreateObject("ADODB.Connection")dbconn.ConnectionString =Application("Aupd_connectionstring")dbconn.Open Application("dbconn_RuntimeUserName"),Application("DbConn_RuntimePassword")SQLQuery= "SELECT Usrs.Id, Usrs.psw, Usrs.Cli, Usrs.Mail, Usrs.Tipo, Usrs.Area, Usrs.Act " & _ "From Usrs " & _ "Where Id='" & cId & "' " & _ "order by Id"Set RS=dbconn.Execute(SQLQuery)%><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Test</title></head><body><% Response.Write(Rs("Id"))%><p><STRONG><FONT face=Tahoma color=dimgray size="2"> <INPUT id=btnsave type=submit value="Conferma"></FONT></STRONG></p></body></html><%dbconn.CloseSet RS=Nothing%> Link to comment Share on other sites More sharing options...
Jerome Posted November 11, 2005 Share Posted November 11, 2005 Why are using the application object? Link to comment Share on other sites More sharing options...
kansasprog Posted November 11, 2005 Share Posted November 11, 2005 Situation: in an ASP page i have created i read a table and i display an ID from the table then i have a button and when i click on a run a new query and then the window has to be closed. (This page is an example page made it to specify my problem)The problem: when i click the button the btnsave_onclick proc is executed but if i insert the commands to open my table it is non completely executed. If i leave only a msgbox("HELLO") and a window.close commands there are non problem. If i insert all the rows to create a connection i don't see the msgbox("HELLO"); another problem is that i have set some Application variables in Global.ASA and normally i can read them from vbscript code buto in this proc i can't read them. Where is my error ?I put my asp page code.Thanks in advance for help. <script LANGUAGE="vbscript">Sub btnsave_onclick// Is this an ADO Object.. if so it has to be set dbconn = CreateObject("ADODB.Connection") dbconn = CreateObject("ADODB.Connection") nice example on w3schools. http://www.w3schools.com/ado/prop_conn_connectionstring.aspDid you store your database connection in application variable....Application(Aupd_connectionstring")[/ ' from here commands are not executed'and variables are non readdbconn.ConnectionString = "Provider=VFPOLEDB;Data Source=c:\inetpub\wwwroot\acut\database\Aupd\;Collating Sequence=Machine"dbconn.Open "",""'dbConn.ConnectionString = Application(Aupd_connectionstring")'dbconn.Open Application("dbconn_RuntimeUserName"),Application("DbConn_RuntimePassword")SQLQuery= "Select * From Usrs" msgbox("HELLO")window.CloseEnd Sub</script><%cId = Request.QueryString("Id")Set dbconn = Server.CreateObject("ADODB.Connection")dbconn.ConnectionString =Application("Aupd_connectionstring")dbconn.Open Application("dbconn_RuntimeUserName"),Application("DbConn_RuntimePassword")SQLQuery= "SELECT Usrs.Id, Usrs.psw, Usrs.Cli, Usrs.Mail, Usrs.Tipo, Usrs.Area, Usrs.Act " & _ "From Usrs " & _ "Where Id='" & cId & "' " & _ "order by Id"Set RS=dbconn.Execute(SQLQuery)%><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Test</title></head><body><% Response.Write(Rs("Id"))%><p><STRONG><FONT face=Tahoma color=dimgray size="2"> <INPUT id=btnsave type=submit value="Conferma"></FONT></STRONG></p></body></html><%dbconn.CloseSet RS=Nothing%><{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now