开发者

Define Parameters Programmatically for GridView Select Query

开发者 https://www.devze.com 2023-01-04 19:03 出处:网络
I am trying to show a Gridview that lists information in a database based on a query.The query takes a parameter of a string, how do you define what this parameter is.An example of the screen I am stu

I am trying to show a Gridview that lists information in a database based on a query. The query takes a parameter of a string, how do you define what this parameter is. An example of the screen I am stuck at is:

http://static.asp.net/asp.net/images/dataaccess/07fig08cs.png

An example of the code I want to use is:

parameter for my object data source select query = OBDS_Query_Parameter

OBDS_Query_Parameter = str;

Edit


Sorry Im not sure how to explain it...

For instance if I have a query that GetAllProducts(String userName); How do I pass or define what userName is when using the data gridview. I am using an Object DataSource and linking the data Gridview to that.

I can do this without the object data source and strictly melodramatically like this:

quartz_SongsTableAdapter songsAdapter = new quartz_SongsTableAdapter();
CurrentRole = "admin";
GridView1.DataSource = songsAdapter.GetSongForClie开发者_运维知识库nt(CurrentRole);
GridView1.DataBind();


Not so clear about your question, I hope I'm not misunderstanding.

IDataParameter p;
p = DataProvider.GetDataParameter(....)
0

精彩评论

暂无评论...
验证码 换一张
取 消