Adding custom query to typed dataset

Below code will work if you working with typed dataset and you want to execute your own queries against adapters i.e. custom queries with typed dataset.

So you have to utilize the partial class of adapters.

namespace MyWin.DataSet1TableAdapters //partial class to add my custom method to update the command collection and queries.

public partial class EmpTableAdapter
public void fillformyquery(MyWin.DataSet1.EmpDataTable emp1)
System.Data.OleDb.OleDbCommand[] mycol = new System.Data.OleDb.OleDbCommand[1];

mycol[0] = new global::System.Data.OleDb.OleDbCommand();
mycol[0].Connection = this.Connection;
mycol[0].CommandText = “Select * from emp where name = ‘%alliswell%'”;
mycol[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection = mycol;

//this._commandCollection = new System.Data.OleDb.OleDbCommand[1];

//calling code

public void RunMyQuery()
dataset1.EmpTableAdapter eda = new dataset1.EmpTableAdapter();//assume you have added adapter to the designeer
dataset1.EmpDataTable emp1 = new dataset1.EmpDataTable();


This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

2 Responses to Adding custom query to typed dataset

  1. My spouse and I absolutely love your blog and find many of your post’s to be what precisely I’m looking
    for. Does one offer guest writers to write
    content in your case? I wouldn’t mind composing a post or elaborating on a few of the subjects you write regarding here. Again, awesome website!

  2. {
    {I have|I’ve} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It’s|It is}
    pretty worth enough for me. {In my opinion|Personally|In
    my view}, if all {webmasters|site owners|websi

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s