digitallyskilled
IS-IT--Management
I want to be able to get the items in a datatable into an array. The stored procedure populates the datatable. Ultimatly i will need to pass the array to another method that will extract the array and process the orderId.
public static int[] GetOrderId(int InvoiceId)
{
// Declare and initialize the return value
int [] orders = new int [0];
// Get the orders associated with an invoice
try
{
int @invoiceNo = InvoiceId;
DataSet ds = new DataSet();
string sqlConnection = ConfigurationSettings.AppSettings["SqlConnection"];
string spName = "getIOsByInvoice";
SqlParameter[] storedParams = new SqlParameter[0];
storedParams = SqlHelperParameterCache.GetSpParameterSet(sqlConnection, spName);
storedParams[0].Value = @invoiceNo;
ds = SqlHelper.ExecuteDataset(
sqlConnection,
CommandType.StoredProcedure,
spName,
storedParams);
DataTable dt = new DataTable();
dt = ds.Tables[0];
for(int i = 0; i < dt.Rows.Count; i++)
{
?????
}
}
catch
{
}
return orders;
}
public static int[] GetOrderId(int InvoiceId)
{
// Declare and initialize the return value
int [] orders = new int [0];
// Get the orders associated with an invoice
try
{
int @invoiceNo = InvoiceId;
DataSet ds = new DataSet();
string sqlConnection = ConfigurationSettings.AppSettings["SqlConnection"];
string spName = "getIOsByInvoice";
SqlParameter[] storedParams = new SqlParameter[0];
storedParams = SqlHelperParameterCache.GetSpParameterSet(sqlConnection, spName);
storedParams[0].Value = @invoiceNo;
ds = SqlHelper.ExecuteDataset(
sqlConnection,
CommandType.StoredProcedure,
spName,
storedParams);
DataTable dt = new DataTable();
dt = ds.Tables[0];
for(int i = 0; i < dt.Rows.Count; i++)
{
?????
}
}
catch
{
}
return orders;
}