. Net is connected to the db2 database through oledb and the built-in connection method of ibm. An error occurred while connecting to the db2 database.

Source: Internet
Author: User

First connection through ibm
DataSet ds = new DataSet ();
OleDbConnection cn = new OleDbConnection (
"Provider = IBMDA400.1; Data Source = 192.168.21.10; User ID = b4dd;" +
"Password = b4dd; Default Collection = QIBMPP ");
Cn. Open ();
OleDbDataAdapter adp = new OleDbDataAdapter ("select * from qibmpp. CUSTOM", cn );
Adp. Fill (ds, "0 ");
If (ds. Tables. Count> 0)
{
DataGridView1.Refresh ();
This. dataGridView1.DataSource = ds. Tables [0]. DefaultView;
}
Why is the following error displayed?
"IBMDA400.1" failed. No error message is available. Result code: E_UNEXPECTED (0x8000FFFF ).

Another connection through oledb
DataSet ds = new DataSet ();
OleDbConnection Conn = new OleDbConnection ("Provider = IBMDA400.DataSource. 1; Data Source = ibm.com.cn; Persist Security Info = True; User ID = sss; PASSWORD = ssss ");
Conn. Open ();
OleDbDataAdapter adp = new OleDbDataAdapter ("select * from QIBMPP. CUSTOM", Conn );
// Adp. Fill (ds, "cust ");
Adp. Fill (ds, "CUSTOM ");
If (ds. Tables. Count> 0)
{
DataGridView1.Refresh ();
This. dataGridView1.DataSource = ds. Tables [0]. DefaultView;

}
The following error message is displayed?
Try to read or write the protected memory. This usually indicates that other memory is damaged.

Could you help me solve this problem? Thank you, online, etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.