Blank records inserting into SQL DB

Results 1 to 5 of 5

Thread: Blank records inserting into SQL DB

  1. #1
    Join Date
    Dec 1969
    Posts
    13

    Default Blank records inserting into SQL DB

    Records are being added to my SQL db but they&#039re blank! This is my code:<BR>sql = "INSERT INTO submit2" <BR>sql = sql & "(Description1, Location1) " _<BR> & "SELECT &#039" & strDescription1 & "&#039 AS Description, &#039"_<BR> & strLocation1 & "&#039 AS location;"<BR> <BR>oConn.Execute (Sql)<BR><BR>Anyone know why my text is not being written to sql? Properties on the data in sql is var char, 255 characters. Thank you in advance.

  2. #2
    Join Date
    Dec 1969
    Posts
    168

    Default RE: Blank records inserting into SQL DB

    sql = "INSERT INTO submit2 (Description1, Location1) VALUES (&#039" & strDescription1 & "&#039,&#039" & strLocation1 & "&#039);"<BR><BR>Hope this helps... Cheers!<BR><BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    13

    Default RE: Blank records inserting into SQL DB

    Thank&#039s for the code Desiree but it still doesn&#039t work. I still have blank records being added. Any other ideas??<BR>Thank you for help.

  4. #4
    Jairo Guest

    Default RE: Blank records inserting into SQL DB

    Carly,<BR>I think this is what you&#039re looking for:<BR><BR>sql = "INSERT INTO submit2" <BR>sql = sql & "(Description1, Location1)"<BR>sql = sql & "(SELECT " & strDescription1 & ", "<BR>sql = sql & strLocation1 & ")"<BR><BR>HTH,<BR>Jairo<BR>http://www.citywebarchitects.com


  5. #5
    Join Date
    Dec 1969
    Posts
    168

    Default RE: Blank records inserting into SQL DB

    try this:<BR>sql = "INSERT INTO submit2 (Description1, Location1) VALUES (&#039" & strDescription1 & "&#039,&#039" & strLocation1 & "&#039);"<BR>response.write SQL<BR>&#039 or<BR>&#039response.write("&#060;!-- " & SQL &" --&#062;)<BR>&#039and do a view source to see<BR><BR>and check what the SQL statement is. If you are not getting errors when inserting, it may be that strDescription1 and strLocation1 are blank themselves?

Posting Permissions

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