|
-
March 6th, 2003, 12:40 PM
#2
Hi! try this!
Any questions?
// C#
private static void FillDataTable(String sqlProc, DataTable dataTable, SqlParameter[] Parameters)
{
SqlConnection connection = new SqlConnection(CONNECTION_STRING);
SqlCommand command = new SqlCommand(sqlProc, connection);
command.CommandType = CommandType.StoredProcedure;
foreach (SqlParameter par in Parameters)
{
command.Parameters.Add(par);
}
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dataTable);
}
public static void GetDataFromSomeStoreProc(DataTable datatable, SqlParameter[] Parameters)
{
FillDataTable("GetDataFromSomeStrProc", datatable, Parameters);
}
private void SomeCall()
{
int param1 = 1111;
string param2 = "ppp";
GetDataFromSomeStoreProc(yourDataTable,
new SqlParameter[] { new SqlParameter("@Param1", param1),
new SqlParameter("@Param2", param2)
});
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|