mckenzie Posted March 3, 2006 Share Posted March 3, 2006 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 More sharing options...
mckenzie Posted March 3, 2006 Author Share Posted March 3, 2006 <% 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 More sharing options...
mckenzie Posted March 3, 2006 Author Share Posted March 3, 2006 yeh done it, bloody access doesn't recognise "&" symbols for table names. i think!and spaces within the names Link to comment Share on other sites More sharing options...
mckenzie Posted March 3, 2006 Author Share Posted March 3, 2006 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 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