html form to acess database via asp (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


1220a -> html form to acess database via asp (5/21/2004 19:54:14)

pls help:
code in question:

<%
Dim FirstName, LastName, Company, Telephone, Email, Business, Service, Pages, Length, Message
Dim Conn
Dim SQL

If request("insrow") = "1" THEN
FirstName = request("FirstName")
LastName = request("LastName")
Company = request("Company")
Telephone = request("Telephone")
Email = request("Email")
Business = request("Business")
Service = request("Service")
Pages = request("Pages")
Length = request("Length")
Message = request("Message")

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("<%
Dim FirstName, LastName, Company, Telephone, Email, Business, Service, Pages, Length, Message
Dim Conn
Dim SQL



SQL = "INSERT INTO tblQuote (FirstName, LastName, Company, Telephone, Email, Business, Services, Pages, Length, Message) VALUES(" & FirstName & ", " & LastName & ", '" & Company & "', " & Telephone & ", " & Email & ", " & Business & ", " & Service & ", " & Pages & ", " & Length & ", " & Message & ")"

'Response.Write("SQL statement is " & SQL)
'Response.End()
Conn.Execute (SQL)

Conn.Close
Set Conn = Nothing
response.write("<p>Your message has been sent!</p>")
End If

%>"




returns:
Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

/_contact/thankyou.asp, line 193

here is the statement:

INSERT INTO tblQuote (FirstName, LastName, Company, Telephone, Email, Business, Services, Pages, Length, Message) VALUES(s, s, s, s, s, s, , , , )

I could use some help
pls
thx in advance




Spooky -> RE: html form to acess database via asp (5/21/2004 20:29:18)

The expected input for a text field is 'value' (with quotes)

SQL = "INSERT INTO tblQuote (FirstName, LastName, Company, Telephone, Email, Business, Services, Pages, Length, Message) VALUES('" & FirstName & "','" & LastName & "','" & Company & "','" & Telephone & "','" & Email & "','" & Business & "','" & Service & "', '" & Pages & "','" & Length & "', '" & Message & "')"




1220a -> RE: html form to acess database via asp (5/21/2004 20:53:40)

SQL = "INSERT INTO tblQuote (FirstName, LastName, Company, Telephone, Email, Business, Services, Pages, Length, Message) VALUES('" & FirstName & "','" & LastName & "','" & Company & "','" & Telephone & "','" & Email & "','" & Business & "','" & Service & "', '" & Pages & "','" & Length & "', '" & Message & "')"


when i serve this up it returns

Microsoft JET Database Engine error '80040e37'

Could not find output table 'tblQuote'.

/_contact/thankyou.asp, line 193

any ideas

thankyou




1220a -> RE: html form to acess database via asp (5/21/2004 20:57:30)

SQL = "INSERT INTO tblQuote (FirstName, LastName, Company, Telephone, Email, Business, Services, Pages, Length, Message) VALUES(" & FirstName & ", " & LastName & ", '" & Company & "', " & Telephone & ", " & Email & ", " & Business & ", " & Service & ", " & Pages & ", " & Length & ", " & Message & ")"

if
i take out tbl

it returns

Microsoft JET Database Engine error '80040e07'

Data type mismatch in criteria expression.

/_contact/thankyou.asp, line 193




1220a -> RE: html form to acess database via asp (5/21/2004 21:04:16)

don't know if this comes into play though i have another feild in the database which QuoteID and auto number...
Not sure if this would come into play.

thx




BeTheBall -> RE: html form to acess database via asp (5/21/2004 21:24:37)

So what is the name of the table in the database? Is it tblQuote or Quote?

Assuming the table name is Quote and all the field values are datatype text, then this should work:

SQL = "INSERT INTO Quote (FirstName, LastName, Company, Telephone, Email, Business, Services, Pages, Length, Message) VALUES('" & FirstName & "','" & LastName & "','" & Company & "','" & Telephone & "','" & Email & "','" & Business & "','" & Service & "', '" & Pages & "','" & Length & "', '" & Message & "')"

If any of the these field are numeric, then delete the single quotes. For example, if Length is a numeric field in your db, then '" & Length & "' becomes " & Length & "




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625