Jump to content

stupid syntax error with SQL Statement


mckenzie

Recommended Posts

keep getting this error message about my SQL statement.deosn't like the "from" instruction.Syntax error in FROM clause.here's my code for a populated drop down box<% Dim connDim CmdPopulatefoodDim SQL set Conn = Server.createobject("ADODB.Connection")conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("project.mdb") &";"Set CmdPopulatefood = Server.CreateObject("ADODB.Recordset")%><% 'conn.Open "DSN=System_DSN_Name" SQL = "SELECT NAME FROM BAKERY & CAKES"CmdPopulatefood.Open SQL, conn%><form method="POST" action="somepage.asp"><Select Name="NAME" size="1"><%While Not CmdPopulatefood.EOF%><option value="<%= CmdPopulatefood("NAME") %>"><%= CmdPopulatefood("NAME") %></option><%CmdPopulatefood.MoveNextWend CmdPopulatefood.CloseSet CmdPopulatefood = Nothingconn.CloseSet conn = Nothing%></Select><input type="submit" value="Submit"></form> :)

Link to comment
Share on other sites

<% Dim connDim CmdPopulatefoodDim SQL set Conn = Server.createobject("ADODB.Connection")conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("project.mdb") &";"Set CmdPopulatefood = Server.CreateObject("ADODB.Recordset")%><% SQL = "SELECT NAME FROM BAKERY & CAKES"CmdPopulatefood.Open SQL, conn%><form method="POST" action="default.asp"><Select Name="NAME" size="1"><%While Not CmdPopulatefood.EOF%><option value="<%= CmdPopulatefood("NAME") %>"><%= CmdPopulatefood("NAME") %></option><%CmdPopulatefood.MoveNextWend CmdPopulatefood.CloseSet CmdPopulatefood = Nothingconn.CloseSet conn = Nothing%></Select><input type="submit" value="Submit"></form>

Link to comment
Share on other sites

when i click an item on the drop down box i want the price to be generated from the database and displayed next to it.how would i go about doin this?here's the code:<% Dim connDim CmdPopulatefoodDim SQL set Conn = Server.createobject("ADODB.Connection")conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("Project.mdb") &";"Set CmdPopulatefood = Server.CreateObject("ADODB.Recordset")%><% SQL = "SELECT name from BAKERYandCAKES "CmdPopulatefood.Open SQL, conn%><form method="POST" action="default.asp"><Select Name="NAME" size="1"><%While Not CmdPopulatefood.EOF%><option value="<%= CmdPopulatefood("NAME") %>"><%= CmdPopulatefood("NAME") %></option><%CmdPopulatefood.MoveNextWend CmdPopulatefood.CloseSet CmdPopulatefood = Nothingconn.CloseSet conn = Nothing%></Select><input type="submit" value="Submit"></form>thankyou :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...