it's my program.
really strange!!
Ole -> 0
Sql -> 1
Do I need to set something else?
thanks!
private void button1_Click(object sender, System.EventArgs e)
{
try
{
//string dbstring = "Provider=SQLOLEDB.1;User ID=sa;Password=ccbswsd;Data
Source=CCBS-EDMSDB4;Use Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=MULLIN-YU;Use Encryption for Data=False;Tag with
column collation when possible=False;database=CCBSAPP";
string dbstring = "Provider=SQLOLEDB.1;User ID=sa;Password=ccbswsd;Data
Source=CCBS-EDMSDB4;Packet Size=4096;database=CCBSAPP";
OleDbConnection conn = new OleDbConnection(dbstring);
OleDbCommand oleCommand = new OleDbCommand();
oleCommand.CommandText = "GetJobItems";
oleCommand.CommandType = CommandType.StoredProcedure;
oleCommand.Connection = conn;
DataTable results = new DataTable("OutboundQueueItem");
OleDbDataAdapter oleDataAdapter = new OleDbDataAdapter(oleCommand);
//string valMachine = "localhost";
//int valOutboundType = 2;
string valMachine = "aaa";
int valOutboundType = 2;
OleDbParameter paramMachine = new OleDbParameter("@Machine",
OleDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0,
"MachineLocked", DataRowVersion.Current, valMachine);
OleDbParameter paramOutboundType = new OleDbParameter("@OutboundType",
OleDbType.Integer, 4, ParameterDirection.Input, false, 0, 0, "OutboundType",
DataRowVersion.Current, valOutboundType);
oleCommand.Parameters.Add(paramMachine);
oleCommand.Parameters.Add(paramOutboundType);
oleDataAdapter.Fill(results);
MessageBox.Show("count: " + results.Rows.Count);
}
catch(OleDbException oleex)
{
Console.WriteLine(oleex.Message);
}
catch(Exception ex)
{
throw ex;
}
}
private void button2_Click(object sender, System.EventArgs e)
{
string dbstring = "User ID=sa;Password=ccbswsd;Data
Source=CCBS-EDMSDB4;Packet Size=4096;Workstation
ID=MULLIN-YU;database=CCBSAPP";
SqlConnection conn = new SqlConnection(dbstring);
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.CommandText = "GetJobItems";
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Connection = conn;
DataTable results = new DataTable("OutboundQueueItem");
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
//string valMachine = "localhost";
//int valOutboundType = 2;
string valMachine = "aaa";
int valOutboundType = 2;
SqlParameter paramMachine = new SqlParameter("@Machine", SqlDbType.VarChar,
20, ParameterDirection.Input, false, 0, 0, "MachineLocked",
DataRowVersion.Current, valMachine);
SqlParameter paramOutboundType = new SqlParameter("@OutboundType",
SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "OutboundType",
DataRowVersion.Current, valOutboundType);
sqlCommand.Parameters.Add(paramMachine);
sqlCommand.Parameters.Add(paramOutboundType);
//sqlCommand.Connection.Open();
sqlDataAdapter.Fill(results);
conn.Close();
conn.Dispose();
MessageBox.Show("count: " + results.Rows.Count);
}