Reputation: 1
So here's the situation. I tried to use a quick way to get info from my database and put it in a table. Apparently, if I ask too much info from the following select, it just won't work.
<%
var myConn, myRec, refCo, myCmd;
refCo = Request.querystring("refC");
Response.Write(refCo);
myConn = new ActiveXObject("ADODB.Connection");
myRec = new ActiveXObject("ADODB.Recordset");
myCmd = new ActiveXObject("ADODB.Command");
myConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/inetpub/wwwroot/unsite/database/world2003.mdb;");
/* myCmd.ActiveConnection = myConn;
myCmd.CommandText = "SELECT NameCountry, Capital, Language, Area, Population, Descripton FROM COUNTRIES WHERE NumCountry = " + refCo";
myCmd.Execute(); */
myRec.Open("SELECT NameCountry, Capital, Language, Area, Population, Descripton FROM COUNTRIES WHERE NumCountry = " + refCo,myConn);%>
See the myRec.Open? It does not allow me to go pass Capital. It just won't. I figured that maybe it was too much and to go with the longer form, meaning a ADODB Command. Say I take off the comments and use myCmd, it won't work at all. Can anyone help me?
Upvotes: 0
Views: 664
Reputation: 2442
It is not because of the number of items in the select list, but because you have a reserved word Language
as a field name. You could rename the field to something else or escape it as [Language]
.
Change your query to:SELECT NameCountry, Capital, [Language], Area, Population, Descripton FROM COUNTRIES WHERE NumCountry = " + refCo
and it should work
See this: List of reserved words in Jet 4.0
Upvotes: 1