Hi friends
I have tried to connect as/400 database from my window application. as/400 database located in another location. i have tried to connect from my local machine.but its keep on getting error (communication error and connection could not be open). can any one guide me. here i have posted my coding.
I have tried to connect as/400 database from my window application. as/400 database located in another location. i have tried to connect from my local machine.but its keep on getting error (communication error and connection could not be open). can any one guide me. here i have posted my coding.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IBM.Data.DB2.iSeries;
using System.IO;
using System.Diagnostics;
namespace dummyas400
{
//;Database=S068F966
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
iDB2Connection con = new iDB2Connection("DataSource=XXX.XX.XXX.XX:XX;userid=XXXXX;password=XXXX;CheckConnectionOnOpen=true;EnablePreFetch=false;");
con.Open();
iDB2Command cmd = new iDB2Command();
iDB2DataAdapter da;
cmd.Connection = con;
cmd.CommandText = "select * from marwellsys.sampledb";
//con.Open();
da = new iDB2DataAdapter(cmd.CommandText, con);
//DataSet ds = new DataSet();
//ds.Clear();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
con.Close();
}
}
}
Comment