Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# App to get Data from MAS200 = problems

Status
Not open for further replies.

HiTechFred

Programmer
Aug 15, 2005
11
US
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
mas200_error_program.jpg
. 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 also Just tried Version 3.22 and same error .. grrrrr
 
I got it working, it was very picky about the connection string. I'm using ProvideX ver.3.22

Here's my string ..

string connString = "Driver={ProvideX 32-Bit ODBC Driver};" + "Persist Security Info=False;DNS=XXXXX;" +
"UID=XXXXX;" + "PWD=XXXX;" + "Directory=\\\\111.18.1.893\\best\\mas90;"+
"Company=XXX;LogFile=\\pvxodb32.log;"+ "CacheSize=4;DirtyReads=1;BurstMode=1;SERVER=NotTheServer";
 
I do not use C in any form with Mas, but I am a C programmer, so I will keep your string on file in case a need arises.


Thank you for posting the solution.

ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
No problem, gkad to have helped. We are using perl right now for MAS200 things, but I wanted to see if there was a C# way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top