× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Figured it out. sqlStatement should have been "string sqlStatement =
"MPRLIB.SIGNTIMESHEET";"

--
Mike Wills
http://mikewills.info
P: (507) 933-0880 | Skype: koldark


On Tue, Jul 6, 2010 at 2:12 PM, Mike <koldark@xxxxxxxxx> wrote:

I am trying to call an external stored procedure (calls an RPG program). I
keep getting the following error:

"*Exception Details: *IBM.Data.DB2.iSeries.iDB2SQLErrorException: SQL0104
Token @SSN was not valid. Valid tokens: :."

Here is my code:

using (iDB2Connection conn = new iDB2Connection(_CONNSTRING))
{
conn.Open();

string sqlStatement = "MPRLIB.SIGNTIMESHEET (@SSN,
@SIGNATURE, @WORKSTATION, @TOTALHOURS, @COMMENT)";
//string sqlStatement = "MPRLIB.SIGNTIMESHEET (?, ?, ?, ?,
?)";

iDB2Command cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sqlStatement;
cmd.Parameters.Add("@SSN",
timesheet.EmployeeUniqueKey.ToString("0000000000"));
cmd.Parameters.Add("@SIGNATURE",
timesheet.EmployeeTypedName);
cmd.Parameters.Add("@WORKSTATION",
timesheet.EmployeeSignedComputer);
cmd.Parameters.Add("@TOTALHOURS",
GetJobHoursTotal(timesheet.Id).ToString("00000.000").Replace(".", ""));
cmd.Parameters.Add("@COMMENT", timesheet.EmployeeComments);

cmd.ExecuteNonQuery();
conn.Close();
}

I can't seem to figure out what is happening or why I am getting the above
error. My connection string looks like:

private const string _CONNSTRING =
"DataSource=192.168.50.200;DefaultCollection=QMFILES;Naming=sql;UserID=XXX;Password=XXX;";

Could it be a library list issue? The program just references one file that
is in the library list. Any suggestions?

--
Mike Wills
http://mikewills.info
P: (507) 933-0880 | Skype: koldark


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.