reading from database to database

Results 1 to 3 of 3

Thread: reading from database to database

  1. #1
    Mark Guest

    Default reading from database to database

    Hi.<BR><BR>Very simple problem, I&#039m sure. But bear with me, please.<BR><BR>I have two databases. I am taking information, based on a user response, to generate a second page. In other words, a database will come up, with links to other databases. My problem is, I don&#039t think I am passing it correctly, or something.<BR><BR>Some code to decipher the madness:<BR><BR>/<BR>AdNumber = Trim(Request("Subject"))<BR><BR>If AdNumber = "" Then<BR> Response.Write "No messages were sent"<BR>Else<BR> Set Class = Connect.Execute("SELECT * FROM MessageData WHERE AdNumber=" & AdNumber)<BR><BR>ShowAds Class("Name"), Class("Subject"), etc., etc., etc.<BR>/<BR><BR>Where AdNumber is the number defined in Access as an AutoNumber, where a link is set up to go to a certain page (via AddMessage.asp?=&#060;%=Class"AdNumber"%&#062; - thingy.<BR><BR>Anyway, I keep getting a syntax error on the line that reads Set Class = ........<BR><BR>It tells me that I have a syntax error on the phrase that reads:<BR>&#039AdNumber=&#039<BR> <BR>Now, I do have that line in my actual code all on one line, so I don&#039t think it is something as simple as that, but ??? Stumped.<BR><BR>-Mark

  2. #2
    Hema S Guest

    Default RE: reading from database to database

    I&#039m assuming u&#039ve done this :<BR>&#060;% <BR> Set Class = Server.Createobject("Adodb.Recordset")<BR>%&#062;< BR><BR>Anyway, whenever u feel u have a problem with the sql statement syntax, Always put the statement into a seperate variable & print it out like :<BR>&#060;%<BR> mySql = "SELECT * FROM MessageData WHERE AdNumber = " <BR> mySql = mySql & AdNumber<BR> Response.Write mySql<BR> Set Class = Connect.Execute(mySql)<BR>%&#062;<BR>Now this will print out the statement & u&#039ll be able to zero in on ur problem.<BR>Hema

  3. #3
    Mark Guest

    Default RE: reading from database to database

    It didn&#039t work. I still get a syntax error on the AdNumber=" part. Like it doesn&#039t want to read the number assigned to it on the previous page or something. Could this be my problem? I got to thinking about this. <BR><BR>I know that the Trim() function passes and recieves a string. However, AdNumber is defined as an AutoNumber in Microsoft Access. Could it be a mismatched file? On paper maybe, but you would think it would tell you that.<BR><BR>It has to be something very simple. It is a simple & operative that is ultimately holding me up. What a waste. <BR><BR>Help if you can.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts