HiTechFred
Programmer
Hi Everyone,
I'm glad I've found this board, hopefully someone will have some answers for me.
First Off, I've searched the forum and I haven't had any luck with this problem.
I want to write a simple C# application to grab some data from MAS200. I'm connecting fine, but when it comes time to read the data, my application bombs out with the following error
. Many of those who have posted in the past get this error when they are trying to access MAS200 from a web page, but I am not.
I'm using the ProvideX driver 3.33.1000
Here's my code, hopefully someone will see something that I'm doing wrong. Thanks in advance.
- Fred
#### Code #####
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Data.Odbc;
public OdbcDataReader myReader;
private void test() {
string connString = "Driver={ProvideX 32-Bit ODBC Driver};DNS=XXXXX;UID=87;PWD=XXXXX;Company=XXX";
OdbcConnection conn = new OdbcConnection(connString);
string SQLQuery = "SELECT IM1_InventoryMasterFile.ItemNumber FROM IM1_InventoryMasterFile";
OdbcCommand myCommand = new OdbcCommand(SQLQuery, conn);
try
{
conn.Open();
myReader = myCommand.ExecuteReader(); // Always call Read before accessing data.
MessageBox.Show("Connected...");
while (myReader.Read()) {
Console.WriteLine(myReader.GetString(0) );
} // while
} // try
catch(Exception e) {
MessageBox.Show( e.ToString() );
}
// always call Close when done reading.
myReader.Close();
conn.Close();
MessageBox.Show("Disconnected...");
} // Function
I'm glad I've found this board, hopefully someone will have some answers for me.
First Off, I've searched the forum and I haven't had any luck with this problem.
I want to write a simple C# application to grab some data from MAS200. I'm connecting fine, but when it comes time to read the data, my application bombs out with the following error
I'm using the ProvideX driver 3.33.1000
Here's my code, hopefully someone will see something that I'm doing wrong. Thanks in advance.
- Fred
#### Code #####
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Data.Odbc;
public OdbcDataReader myReader;
private void test() {
string connString = "Driver={ProvideX 32-Bit ODBC Driver};DNS=XXXXX;UID=87;PWD=XXXXX;Company=XXX";
OdbcConnection conn = new OdbcConnection(connString);
string SQLQuery = "SELECT IM1_InventoryMasterFile.ItemNumber FROM IM1_InventoryMasterFile";
OdbcCommand myCommand = new OdbcCommand(SQLQuery, conn);
try
{
conn.Open();
myReader = myCommand.ExecuteReader(); // Always call Read before accessing data.
MessageBox.Show("Connected...");
while (myReader.Read()) {
Console.WriteLine(myReader.GetString(0) );
} // while
} // try
catch(Exception e) {
MessageBox.Show( e.ToString() );
}
// always call Close when done reading.
myReader.Close();
conn.Close();
MessageBox.Show("Disconnected...");
} // Function