lordfa9
-
Posts
43 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by lordfa9
-
-
yar i kinda found 1 program but the prob is that it is a trialware and can only convert only the first 5 records of every table to mysql, lucky i could use phpadmin to quickly fill in the rest, hope your database isn't too bigif u want the program i could send it 2 uYou might also want to try looking on sourceforge.net, the chances of them having a project devoted to converting an access database to another form like a MySQL database is pretty good, I imagine. It's where I've found a lot of useful PHP apps.
u could check w3schools, they have the connection code for access---aspyes .asp files are aspif a proper asp script isn't displaying, check whether the language used is correct and that the <% tag is used, also check if you have installed IISYeah...I'm completely confused since I never use ASP. Can anyone come up with some helpful connection code. Also, what is the file extension for an asp page? When I save it as .asp, it just displays the content of the file instead of the output code. -
so how do i do that loop?
-
date format
in ASP
now i'm really confused i also not sure where that part of code is supposed to go, i put it at the head (after the <%) and the tail (before the %>) and dosn't really work, cept make 6/3/1979 appearthat code seems to be using a lot of variables, do u have the code that defines some of them?
-
hmm i seemed to have solved the prob all i did was to shift the
if request.querystring("tblname")<>"" then tblname=request.querystring("tblname")else Response.Write "<tr><td colspan='4'><h1>Error!!! Please choose a class first</h1></td></tr>" Response.End()end if
code to the top (directly after the <% tag) Now if the error msg is triggered a 1 col 1 row table with the error message in it will appear
-
date format
in ASP
i kinda noticed that the dates in my asp pages diaplay in mm/dd/yyyy format. Is there any way to change the format into dd/mm/yyyy? I am using access with medium date as my date format
-
here it is
<html><style type="text/css"><!--#Layer1 { position:absolute; width:172px; height:21px; z-index:1; left: 12px; top: 51px;}--></style><body><h1 align="center">Class <%=Request.Querystring("tblname")%></h1><div id="Layer1"><a href="/subjects.asp" target="_blank">What Do These Mean?</a></div><table border="1" width="100%" bgcolor="#fff5ee"><tr><th align="left" width=20% bgcolor="#b0c4de"><a href="displayhw.asp?tblname=<%=Request.Querystring("tblname")%>&sort=SubCode&ordering=ASC">Subject Code</a></th><th align="left" width=12% bgcolor="#b0c4de"><a href="displayhw.asp?tblname=<%=Request.Querystring("tblname")%>&sort=DateGiven&ordering=DESC">Date Given</a></th><th align="left" width=12% bgcolor="#b0c4de"><a href="displayhw.asp?tblname=<%=Request.Querystring("tblname")%>&sort=DateDue&ordering=DESC">Date Due</a></th><th align="left" bgcolor="#b0c4de">Information</th></tr><%if request.querystring("tblname")<>"" then tblname=request.querystring("tblname")else Response.Write "<h1>Error!!! Please choose a class first</h1>" Response.End()end ifif request.querystring("sort")<>"" then sort=request.querystring("sort")else sort="DateGiven"end ifif request.querystring("ordering")<>"" then ordering=request.querystring("ordering")else ordering="DESC"end ifset conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/database.mdb"))set rs=Server.CreateObject("ADODB.recordset")sql="SELECT Subcode, DateGiven, DateDue, Information FROM " & tblname & " Order BY " & sort & " " & ordering & ""rs.Open sql,conndo until rs.EOF response.write("<tr>") for each x in rs.Fields response.write("<td>" & x.value & "</td>") next rs.MoveNext response.write("</tr>")looprs.closeconn.close%></table></body></html>
so what i get if the error msg is triggered is (manually triggered error condition and went to view->source)
<html><style type="text/css"><!--#Layer1 { position:absolute; width:172px; height:21px; z-index:1; left: 12px; top: 51px;}--></style><body><h1 align="center">Class </h1><div id="Layer1"><a href="/subjects.asp" target="_blank">What Do These Mean?</a></div><table border="1" width="100%" bgcolor="#fff5ee"><tr><th align="left" width=20% bgcolor="#b0c4de"><a href="displayhw.asp?tblname=&sort=SubCode&ordering=ASC">Subject Code</a></th><th align="left" width=12% bgcolor="#b0c4de"><a href="displayhw.asp?tblname=&sort=DateGiven&ordering=DESC">Date Given</a></th><th align="left" width=12% bgcolor="#b0c4de"><a href="displayhw.asp?tblname=&sort=DateDue&ordering=DESC">Date Due</a></th><th align="left" bgcolor="#b0c4de">Information</th></tr><h1>Error!!! Please choose a class first</h1>
despite what the html says, the error msg appears above the table, dunno y source is like this,on hindsight could it have something to do with the positioning (from top to down) of the error segment of my code?
-
sry man about the recordset thing, i'm that kinda noob where i only learn what i need to do a proj, i dont always understand everything (much less what the code i posted is, i only know it displays everything in a table )
i don't really understand this, do you mean that i have to incoporate some command that keeps track of what page i'm on?If your server does not support the limit keyword, you will need to manually skip ahead to the first record, and display the next 20, keeping track of how many you are showing. -
is there any way for asp to define how many records shown per page, excess records being sent to a second, third....page WITHOUT using recordsets?currently i'm using this code from w3schools to diaplay all recordsdo until rs.EOF response.write("<tr>") for each x in rs.Fields response.write("<td>" & x.value & "</td>") next rs.MoveNext response.write("</tr>")loopconn.closei think it's comething to do with loop but i'm not sure
-
if you meant changing the code to
if request.querystring("tblname")<>"" then tblname=request.querystring("tblname")else Response.Write "Error!!!" Response.End() end ifResponse.End()
now it stops everything from being shown, whether the error statement has been triggered or notOn a related note, does Response.End affect only asp codes or both asp & html codes?
-
i know this can be done by creating many pages and sneakily changing the link's variable (causing the user to alternate between two almost similar pages), but i can't cause this will cause me to create a lot of pages i was just wondering if there was any way to use allow user to choose how to sort a series of records in accending order or descending order using a querystring. For example, the records originally display in no particular order but by clicking a link, the records are arranged in accending order, clicking it again makes the records sort in descending order, a further click makes it sort in accending order and so on
-
ok i'm just presuming that you know how to create a drop down menu (dreamweaver helps alot if u have it)and you know what is a querystring (if you dont know either i can only help u with the querystring)[For the script which is supposed to retrieve and display the records]your connection code will be like this
set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/database.mdb"))set rs=Server.CreateObject("ADODB.recordset")sql="SELECT * FROM " & tblnamers.Open sql,conn
where 'database' is the path of your database (use relative path if possible)add this at the top of your code (after the <% tag)
if request.querystring("tblname")<>"" then tblname=request.querystring("tblname")else tblname="sometablename"end if
where sometablename is a name of one of the tables in your databasewhen creating links for your drop down menu just add a value behind the link for example<a href="scriptname.asp?tblname=anothertablename">anothertable</a>where scriptname is the name of the script which is supposed to display the database records and anothertablename is a name of the table you want to retrieve records fromHope this helps
-
yup, all the remaining html codes below the "end if" statementYou mean it writes out the "Error!!!", and then continues executing whatever is below the IF statement? -
did just that, still dosn't work
-
Response.End
in ASP
sry made a mistake in postingadmin del this plz?
-
thx for the tip man dont really understand the sql statement though i got away with usingsql="SELECT * " & tblname & " Order BY " & sort & ""*shrugs*You have to send two querystring parametars, sort and table name.Your link have to be like this:<a href="haha3.asp?sort=dategiven&tblname=1E1">Link</a>and then when constructing SQL statement your sql statemant should look like this:sort = Request.QueryString("sort")tblname = Request.QueryString("tblname")strSQL = "SELECT * FROM '" & tblname & "' & ORDER BY '" & sort & "';" -
I have this code to check if a variable has been entered into the querystring and to display an error message if there isn't any
if request.querystring("tblname")<>"" then tblname=request.querystring("tblname")else Response.Write "Error!!!" Response.End end if
the remainder of my code contains html elements that i don't want displayed if the error conditions is triggered, is there any way i can just cause the "Error!!!" message to diaplay only?
-
ok this is gonna be a bit long so bear with me plzwhat i need to do is to allow my sql statement to use 2 possible variable inputsFor example:SELECT * FROM A ORDER BY BWhere A and B are the variables i want the user to input before the query is run Currently, i'm using this code for that page and to define the order by clause
<html><body><table border="1" width="100%" bgcolor="#fff5ee"><tr><th align="left" bgcolor="#b0c4de"><a href="haha3.asp?sort=subjectname">Subject</a></th><th align="left" bgcolor="#b0c4de"><a href="haha3.asp?sort=dategiven">Date Given</a></th><th align="left" bgcolor="#b0c4de"><a href="haha3.asp?sort=datedue">Date Due</a></th></tr><%if request.querystring("sort")<>"" then sort=request.querystring("sort")else sort="dategiven"end ifset conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/database.mdb"))set rs=Server.CreateObject("ADODB.recordset")sql="SELECT * FROM 1E1 ORDER BY " & sortrs.Open sql,conndo until rs.EOF response.write("<tr>") for each x in rs.Fields response.write("<td>" & x.value & "</td>") next rs.MoveNext response.write("</tr>")looprs.closeconn.close%></table></body></html>
haha3.asp is the name of the script itself and 1E1 is the table namei actually tried a variant of the script where i changed the SQL statement to SELECT * FROM " & sortthen changing the table script to
<table border="1" width="100%" bgcolor="#fff5ee"><tr><th align="left" bgcolor="#b0c4de"><a href="haha3.asp?sort=1E1">1E1</a></th><th align="left" bgcolor="#b0c4de"><a href="haha3.asp?sort=2E1">2E1</a></th><th align="left" bgcolor="#b0c4de"><a href="haha3.asp?sort=3E1">3E1</a></th></tr>
it worked and i was able to toggle from class to class but lost the order by functionso the question is how am i going to combine both??Appreciate no comments bout the database construction, its supposed to be that way Thanks for taking the patience to read this, all help is appreciated. Sorry if i am asking a question that appears in a tutorial somewhere, a link to that tutorial would be very helpful
Dual Insert?
in ASP
Posted
i wrote a script to insert records into a database adn i noticed that whenever i run it the record will be inserted two times though my script is run only once. this is the code to submit the variables
this is the code to write the stuff to the database
by the way, there is another column in my 1A1 table, it a autonumber value. Could that be affecting my script? It is not refered in my sql INSERT statement