Hi:
I'm developing a C# mobile web application that needs to access a Sybase ASE database (12.5) on the back end. I'm going through OleDB. Here's the problem, although my stored procedures run fine on Sybase, I cannot get my ASP.NET objects to populate from them. I've got 2 objectlists that I'm trying to populate. A code snippet is below. It looks pretty vanilla to me, but I just cannot get it to work. Is there even a way to test data access in VS 2005 without running the app
All advice greatly appreciated!
-Dave
// Create the Connection
OleDbConnection cnOLEDB = new OleDbConnection();
cnOLEDB.ConnectionString =
"Provider=Sybase.ASEOLEDBProvider.2;Data Source=vcijis_test;" +
"Initial Catalog=probation;** blocked out remainder **";
// Our NEW dataset model
dsClientInfo mySet = new dsClientInfo();
// Create the Name & Address Command
OleDbCommand oledbCom1 = new OleDbCommand();
oledbCom1.CommandText =
"pa_get_client_info";
oledbCom1.CommandType =
CommandType.StoredProcedure;
oledbCom1.Connection = cnOLEDB;
// This command uses one Parameter
OleDbParameter par1 = oledbCom1.Parameters.Add(
, OleDbType.Integer);
par1.Value =
Convert.ToInt32 (txtPersonNbr.Text);
// Create the Demographic Command
OleDbCommand oledbCom2 = new OleDbCommand();
oledbCom2.CommandText =
"pa_get_client_demographics";
oledbCom2.CommandType =
CommandType.StoredProcedure;
oledbCom2.Connection = cnOLEDB;
// This command uses one Input Parameter
OleDbParameter par2 = oledbCom2.Parameters.Add(
, OleDbType.Integer);
par2.Value =
Convert.ToInt32(txtPersonNbr.Text);
// Open the Connection
cnOLEDB.Open();
//DataAdapter Stuff goes here
OleDbDataAdapter adap1 = new OleDbDataAdapter();
adap1.SelectCommand = oledbCom1;
adap1.Fill(mySet,
"clientBasics");
adap1.SelectCommand = oledbCom2;
adap1.Fill(mySet,
"clientDemographics");
// Close the Connection
cnOLEDB.Close();
// Work with the ObjectList
ObjectList1.DataSource = mySet.Tables[
"clientBasics"].DefaultView;
ObjectList1.LabelField =
"last";
ObjectList1.DataBind();
ObjectList2.DataSource = mySet;
ObjectList2.DataMember =
"clientDemographics";
ObjectList2.DataBind();
this.ActiveForm = frmDemographic;
***********************************************************
And the Stored Procedure is:
Create Proc dbo.pa_get_client_demographics (
)
As
Begin
/**********************************************************
*Procedure Name: pa_get_client_demographics
*Database: probation
*Server: UT_SERVER
*CAST Tools5,1,3,490
*
*Business Function : Returns most recent physical description
*Author BF: ROM Date BF: 11/21/2006
*File Path:
* Z:\vc_agcy\pa\sql\development\pa_get_client_demographics
*********************************************************/
CREATE TABLE #clientdemo
(
gender varchar(10) NULL,
race varchar(20) NULL,
height smallint NULL,
weight smallint NULL,
eye_color varchar(10) NULL,
hair_color varchar(20) NULL,
lang varchar(30) NULL
)
INSERT INTO #clientdemo
SELECT g.descrip,
r.descrip,
pd.height,
pd.weight,
e.descrip,
h.descrip,
l.descrip
FROM person_demographics pd,
code_entries g,
code_entries r,
code_entries e,
code_entries h,
code_entries l
pd.owner_agency = 'vcpa' and
pd.dt_invalid = null and
pd.dt_updated = (select max(dt_updated) from person_demographics
dt_invalid = null)) and
g.code_nbr =* pd.gender_code and
r.code_nbr =* pd.ethnicity and
e.code_nbr =* pd.eye_color and
h.code_nbr =* pd.hair_color and
l.code_nbr =* pd.language_code
INSERT INTO #clientdemo
SELECT g.descrip,
r.descrip,
pd.height,
pd.weight,
e.descrip,
h.descrip,
l.descrip
FROM person_demographics pd,
code_entries g,
code_entries r,
code_entries e,
code_entries h,
code_entries l
pd.dt_invalid = null and
pd.dt_updated = (select max(dt_updated) from person_demographics
g.code_nbr =* pd.gender_code and
r.code_nbr =* pd.ethnicity and
e.code_nbr =* pd.eye_color and
h.code_nbr =* pd.hair_color and
l.code_nbr =* pd.language_code
SELECT gender,
race,
height,
weight,
eye_color,
hair_color,
lang
FROM #clientdemo
END