[quoted text, click to view] Chris Curtis wrote:
> Hi
>
> I'm a bit out of my depth here but I have successfully managed to
> extract 2 pieces of information from a MySQL database; sMap &
> sLocation. These are used on an asp page (below) which is located in
> a frame and the query is dependent on an id provided from a cgi
> script! From this page I would like to transfer these 2 values onto
> another
> asp page which will contain a form.
> I have tried running the selection query from the new 'form' page but
> it can't refer to the all important 'id' querystring
>
> I had thought I could write the values to a MySQL table and then
> retrieve them on the new page
Not necessary. You can use Session variables, or querystring.
[quoted text, click to view] >
> However, the INSERT INTO statement below will not work
What does "will not work" mean? error messages? Incorrect results? Nothing
happens? We cannot help you if you don't describe your symptoms!
[quoted text, click to view] > but it looks
> right (I have resorted to trying to insert some text as an example).
> I'm guessing I'm missing something simple! What?!
>
> Apart from this there must be an alternative way?
>
> Regards
> Chris Curtis
>
> <%
>
> Dim sQuery, iMap, sMap, sLocation
>
> iMap=Request.QueryString("id")
>
> strConnection =
> "driver={MySQL};server=127.0.0.1;database=mitre;UID=****;password=****
> Set adoDataConn = Server.CreateObject("ADODB.Connection")
> adoDataConn.Open strConnection
>
> sQuery = "SELECT distinctrow industrialestates.estate FROM
> industrialestates INNER JOIN maps on industrialestates.serial =
> maps.indestateid WHERE maps.serial = " & iMap
>
> Set RS = adoDataConn.Execute(sQuery)
>
> sMap = RS("estate")
>
> sQuery = "SELECT distinctrow location.name FROM location INNER JOIN
> maps on location.serial = maps.locationid WHERE maps.serial = " & iMap
>
> Set RS = adoDataConn.Execute(sQuery)
>
> sLocation = RS("name")
>
> sQuery = "INSERT INTO mailingenq(estate, town) VALUES('test',
> 'test2')"
> Set RS = adoDataConn.Execute(sQuery)
This may not causing your problem [1], but an INSERT query DOES NOT RETURN
RECORDS! It is extrememly wasteful to allow ADO to create a recordset when
you know your query is not returning records. A non-records-returning query
should be executed without a recordset, and you should tell ADO not to
bother creating a recordset object in the background (which it does by
default)
'if you've included the adovbs.inc file, or used a meta tag
'to reference the ADO type library, these two lines will
'not be needed:
const adCmdText=1
const adExecNoRecords
adoDataConn.Execute sQuery,,adCmdText + adExecNoRecords
You should stop using dynamic sql. Try out this technique:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
[1] however, in some cases, attempting to reuse a recordset object without
closing it first can cause errors.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"