Click here to Skip to main content
15,914,416 members

Comments by Member 11977135 (Top 7 by date)

Member 11977135 5-Mar-18 13:11pm View    
Since I know there is an API003, maybee it is the Connection string that points on wrong database ?
I use "Default Collection=MVX9MOD;". I used this with the .NET driver "using IBM.Data.DB2.iSeries;" where it is working, but maybee its different in "iSeries Access ODBC Driver" ?
Member 11977135 5-Mar-18 8:49am View    
Thankyou for your code update, but it results in same errormessage. And the API (Stored procedure) is only returning one fixed String, so I don't need a recordset. I also read the your link, but I can not find any useful info there.
Member 11977135 5-Mar-18 8:35am View    
This is working C# code:

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using IBM.Data.DB2.iSeries;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void textBox1_Leave(object sender, EventArgs e)
{


string Connection = "";
bool isChecked = prod.Checked;
if (isChecked)
Connection = "DataSource=172.18.0.50; DefaultCollection=MVX9MOD; UserID=SKS6400; Password=password";
else
Connection = "DataSource=172.18.0.51; DefaultCollection=MVX9MOD; UserID=SKS6400; Password=password";




using (iDB2Connection i5conn = new iDB2Connection(Connection))
try
{

String tidskod = ("001SKA" + scannat.Text);

i5conn.Open();
iDB2Command ptQuery = new iDB2Command("API003", i5conn);
ptQuery.CommandType = CommandType.StoredProcedure;


ptQuery.Parameters.Add("@InFormat", iDB2DbType.iDB2Char);
ptQuery.Parameters["@InFormat"].Direction = ParameterDirection.Input;
ptQuery.Parameters["@InFormat"].Value = "0001";

ptQuery.Parameters.Add("@InData", iDB2DbType.iDB2Char);
ptQuery.Parameters["@InData"].Direction = ParameterDirection.Input;
ptQuery.Parameters["@InData"].Value = tidskod;

ptQuery.Parameters.Add("@OutFormat", iDB2DbType.iDB2Char);
ptQuery.Parameters["@OutFormat"].Direction = ParameterDirection.Input;
ptQuery.Parameters["@OutFormat"].Value = "0001";

ptQuery.Parameters.Add("@OutData", iDB2DbType.iDB2VarChar);
ptQuery.Parameters["@OutData"].Direction = ParameterDirection.Output;
ptQuery.Parameters["@OutData"].Value = "";

ptQuery.Parameters.Add("@ErrorData", iDB2DbType.iDB2VarChar);
ptQuery.Parameters["@ErrorData"].Direction = ParameterDirection.Output;
ptQuery.Parameters["@ErrorData"].Value = "";
ptQuery.ExecuteNonQuery();


String str = (string)(ptQuery.Parameters["@OutData"].Value);
stelle.Text = "";
stelle.Text = (str.Substring(2,10));
omrade.Text = (str.Substring(7,2));
plats.Text = (str.Substring(9));

errors.Text = (string)(ptQuery.Parameters["@ErrorData"].Value);


i5conn.Close();

i5conn.Open();
iDB2Command ptQuery2 = new iDB2Command("API005", i5conn);
ptQuery2.CommandType = CommandType.StoredProcedure;


ptQuery2.Parameters.Add("@InFormat", iDB2DbType.iDB2Char);
ptQuery2.Parameters["@InFormat"].Direction = ParameterDirection.Input;
ptQuery2.Parameters["@InFormat"].Value = "0001";

ptQuery2.Parameters.Add("@InData", iDB2DbType.iDB2Char);
ptQuery2.Parameters["@InData"].Direction = ParameterDirection.Input;
ptQuery2.Parameters["@InData"].Value = tidskod;

ptQuery2.Parameters.Add("@OutFormat", iDB2DbType.iDB2Char);
ptQuery2.Parameters["@OutFormat"].Direction = ParameterDirection.Input;
ptQuery2.Parameters["@OutFormat"].Value = "0001";

ptQuery2.Parameters.Add("@OutData", iDB2DbType.iDB2VarChar);
ptQuery2.Parameters["@OutData"].Direction = ParameterDirection.Output;
Member 11977135 2-Mar-18 16:43pm View    
Indeed there is. I made a program in C# calling the procedure. That is working fine.
Member 11977135 2-Mar-18 16:42pm View    
Deleted
Indeed there is. I made a program in C# calling the procedure. That is working fine.