DatabaseBindingException

Hi all

I bind a variable to an insert statement. As far as my knowledge goes, there nothing wrong in my statement. But it is to show "net.rim.device.api.database.DatabaseBindingException: invalid parameter index'." " Please see my statement

Statement createSDStmt = database.createStatement("CREATE TABLE 'SoDetails'('Sono' nvarchar(8), 'SoInfo' nvarchar(15), 'customer' nvarchar(100), 'addr' nvarchar(100), 'addr2' nvarchar(100), 'city' nvarchar(100), 'terms' nvarchar(100), 'contact' nvarchar(100), 'problem' nvarchar(100), 'comments' nvarchar(100), 'ServCode' nvarchar(14), 'Status_Call' nvarchar(20), 'isupdate' bit, 'custno' nvarchar(16), 'calltype' nvarchar(8), 'Telephone' nvarchar(15), 'Telephone2' nvarchar(15))");

Statement insertStmt = database.createStatement("INSERT INTO SoDetails(Sono, SoInfo, customer, addr, addr2, city, terms, contact, problem, comments, ServCode, Status_Call, isupdate, custno, calltype, Telephone, Telephone2) VALUES ('"+strSDSoNo[index]+"', '"+strSDSoInfo[index]+"', ?, '"+strSDAddr[index]+"', '"+strSDAddr2[index]+"', '"+strSDCity[index]+"', '"+strSDTerms[index]+"', '"+strSDContact[index]+"', '"+strSDProblem[index]+"', '"+strSDComments[index]+"', '"+strSDServCode[index]+"', '"+strSDStatusCall[index]+"', 0, '"+strSDCustNo[index]+"', '"+strSDCallType[index]+"', '"+strSDPhone[index]+"', '"+strSDPhone2[index]+"')");

insertStmt.prepare();
insertStmt.bind(2, strSDCustName[index]);
insertStmt.execute();

When I hardcode the value, it works very well. Can we say the reason for the question of liaison?

I found the solution. It's here

There are two main ways to number the parameters:
1. A question mark (?) in the statement causes each parameter to be numbered sequentially, starting from 1.
2. A question mark followed by an integer (?NNN) in the statement provides each parameter with the number NNN.

The second method worked for me!

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • Where is the

    Where is the button 'Search' on Thunderbird 3? I need to revisit several old emails and can not find them, and there is no search box on my version of Thunderbird.

  • (safari and Touch 3D links) very bad on 9.3

    IM blaming myself to update 9.3 on 6s Cannot use the * correct iPhone going to buy htc m9 < re-titled by host >

  • iMovie 2

    Good afternoon I looked inside my Macbook Air in the Finder and I just realized that both iMovie exists. I managed to take three screenshots for you to tell me that I can do with one of them, we should I remove completely (if any) and how?... and why

  • sbRIO 9606 links that disconnection

    Hi all I have the same phenomenon with http://forums.ni.com/t5/Real-Time-Measurement-and/cRIO-Connects-then-disconnects/td-p/1884039 and http://forums.ni.com/t5/Real-Time-Measurement-and/cRIO-9073-Disconnects/m-p/1751378#M10637 . But, my hardware is

  • Why create dvd windows don't hang up on the coding?

    it restarts