Question Form anology

Wurn

New member
Local time
Today, 09:48
Joined
Oct 16, 2008
Messages
9
Hey all noob here, actually noob with coding also.

Basically i have my display web page with the questions on that the user must fill in. Then post it to go to another .asp page so that the info can be entered into the Access database.

Now on my questions page in my form i have the questions fields named - tblName or tblPersonal.
in my page that updates the database i have it as follows:

Dim name, position, lineman, depart, datejoined, lastworkdate, data_source, con, sql_insert

Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function

tblName = ChkString(Request.Form("name"))
tblPosis = ChkString(Request.Form("position"))
tblLineMan = ChkString(Request.Form("lineman"))
tblDept = ChkString(Request.Form("depart"))
tblDateJoined = ChkString(Request.Form("datejoined"))
tblLastWorkDate = ChkString(Request.Form("lastworkdate"))

data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("exit.mdb")
sql_insert = "insert into users (name, position, lineman, depart, datejoined, lastworkdate) values ('" & _
name & "', '" & position & "', '" & lineman & "', '" & depart & "', '" & datejoined & "', '" & lastworkdate & "')"


So my question is in my table i have named it tblName, tblPosition etc. so did i do it correctly above by inserting it as: tblName = ChkString(Request.Form("name")) or should it beName = ChkString(Request.Form("tblName")) orName = ChkString(Request.Form("name")) and so on?i really do hope i am making any sense here! i dont really know how else to phrase what i am asking
 
If I'm understanding correctly, the actual names in the table are irrelevant to the areas you're asking about. In this code:

tblName = ChkString(Request.Form("name"))

tblName is a variable that will later be used in your SQL, so it must match the variable declared in the Dim line. "name" must be the name of the control on your ASP page. The actual names of the table and fields must be used here:

sql_insert = "insert into users (name, position, lineman...

and the variables you declared and set earlier would be used in the VALUES clause.
 
Thx for help, its making sense now, if i am following you correctly here:

Dim tblName, tblPosis, tblLineMan, tblDept, tblDateJoined, tblLastWorkDate, data_source, con, sql_insert

Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function

tblName = ChkString(Request.Form("name"))
tblPosis = ChkString(Request.Form("position"))
tblLineMan = ChkString(Request.Form("lineman"))
tblDept = ChkString(Request.Form("depart"))
tblDateJoined = ChkString(Request.Form("datejoined"))
tblLastWorkDate = ChkString(Request.Form("lastworkdate"))

data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("/exit.mdb")
sql_insert = "insert into users (name, position, lineman, depart, datejoined, lastworkdate) values ('" & _
tblName & "', '" & tblPosis & "', '" & tblLineMan & "', '" & tblDept & "', '" & tblDateJoined & "', '" & tblLastWorkDate & "')"


is what i have now, but heres waht my page is displaying when running it from my local IIS server:

Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80004005)
The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\site\exit.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
/form_ac.asp, line 30

Browser Type:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3

Page:
POST 402 bytes to /form_ac.asp
POST Data:
tblName=we&tblPosis=&tblLineMan=&tblDept=&tblDateJoined=we&tblLastWorkDate=&1txt1=&1txt1=&1txt1=&1txt1=&1txt1=&1txt1=&2txt1=&2rate1=&2txt2=&2rate2=&2txt3=&2rate3=&2txt4=&2rate4=&2txt5=&2rate5=&2txt6=& . . .

I dont understand why its telling me the database is open. its not and i have given all rights to database and folder its in, but no luck
 
Last edited:
I'll have to poke around. All the work I've done with ASP has been with SQL Server as the back end.
 
Thx man, ill really appreaciate any help here. I am totally dumpfounded here at what is causing it.

I'll have to poke around. All the work I've done with ASP has been with SQL Server as the back end.
 
I have MS Access 2003 still and yes no security on the db as far as i can make out. Hey thx for trying to figure this out. Really appreciated here. I am at a loss

I will check out hte link you gave and see if anyting there will help me, but i fear something else is holding me back here
 

Users who are viewing this thread

Back
Top Bottom