connect as/400 database from dotnet application: communication error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • navanee25
    New Member
    • Mar 2013
    • 2

    connect as/400 database from dotnet application: communication error

    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.

    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();
            }
        }
    }
    Attached Files
    Last edited by acoder; Mar 5 '13, 11:14 AM. Reason: Please use [code] tags when posting code
  • navanee25
    New Member
    • Mar 2013
    • 2

    #2
    how do connect as/400 database from dotnet application

    I want to create window Application Using Dot Net.In that Application i would like to connect As/400 Database(DB2) as Back End tool. But My DB2 is located in different location. For this Requirement what i do and how its possible. Can any one guide me .

    Comment

    Working...