Returns a DataTable for the supplied SQL statement and parameter values

Namespace:  DbNetLink.Data
Assembly:  DbNetLink.DbNetData (in DbNetLink.DbNetData.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public DataTable GetDataTable(
	string Sql,
	IDictionary Params
)
Visual Basic (Declaration)
Public Function GetDataTable ( _
	Sql As String, _
	Params As IDictionary _
) As DataTable
Visual C++
public:
DataTable^ GetDataTable(
	String^ Sql, 
	IDictionary^ Params
)

Parameters

Sql
Type: System..::.String

SQL statement or stored procedure name

Params
Type: System.Collections..::.IDictionary

Parameter values collection

Return Value

A DataTable

Examples

CopyC#
DbNetData Db = new DbNetData( ConfigurationManager.ConnectionStrings["nwind"] );
Db.Open();
Product.DataTextField="ProductName";
Product.DataValueField="ProductID";
ListDictionary Params = new ListDictionary();
Params["categoryid"] = CategoryID.Value;
Product.DataSource = Db.GetDataSet("select * from products where categoryid = @categoryid", Params);
Product.DataBind()
Db.Close();

See Also