SPONSORS:






User Tag List

Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Apr 2001
    Location
    Montreal, CA
    Posts
    74
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is Wrong with this DB_ExecuteSql

    Hi friends,
    [ ] hdbc = DB_Connect("Driver=SQL Server;Server=PROAUTOMATION;Trusted_Connection=no; Database=TEST;Uid=TEST;Pwd=TEST")
    [ ] hstmnt = DB_ExecuteSql (hdbc, "SELECT * FROM TestTable")
    [ ]
    [-] while (DB_FetchNext (hstmnt, id, sData))
    [ ] print ("Dept: {id} Data : {sData} ")
    [ ]
    [ ]
    [ ]
    [ ] DB_FinishSQL (hstmnt)
    [ ]
    [ ] //hstmntInsert = DB_ExecuteSql (hdbc, "INSERT INTO ProAutomation.dbo.TestTable(id,data) VALUES ( '" + iRow + "', Data '" + iRow +"')")
    [ ]
    [ ] //hstmntInsert = DB_ExecuteSql (hdbc, "INSERT INTO ProAutomation.dbo.TestTable(id,data) VALUES ( {iDataValue} , {sData} )")
    [ ] hstmntInsert = DB_ExecuteSql (hdbc, "INSERT INTO TestTable(id,data) VALUES ( {iDataValue} , {sData} )")
    [ ] DB_Disconnect (hdbc)

    TestCase Result :
    [ ] Dept: 1 Data : row 1
    [ ] Dept: 2 Data : row 2
    [ ] Dept: 3 Data : row 3
    [ ] Dept: 4 Data : row 4
    [ ] *** Error: (42000) [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '4'.
    [ ] Occurred in DB_ExecuteSql
    Thanks,
    Murali

    ------------------
    Murali K Parepalli
    Intuit

    [This message has been edited by aspmurali (edited 12-20-2002).]

    [This message has been edited by aspmurali (edited 12-20-2002).]
    _ _ ___________ _ _
    Murali K Parepalli

  2. #2
    Member
    Join Date
    Apr 2001
    Location
    Montreal, CA
    Posts
    74
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: What is Wrong with this DB_ExecuteSql

    In database, column 'id''s IDENTITY property set to true(AutoIncremental). So Naturally, I will not be able to insert data into 'id' column explicitly. And I think sDataValue should be in quotes..
    Anyhow,

    Thanks

    ------------------
    Murali K Parepalli
    Intuit
    _ _ ___________ _ _
    Murali K Parepalli

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:50 PM.

Copyright BetaSoft Inc.