Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Sunday, March 11, 2012

Changing SelectMethod in SQLDataSource

I have a gridview bound to an ObjectDataSource, which is a dataset populated by SQL queries. The gridview works with the default SelectMethod configured in the ObjectDataSource. I would like to be able to change the SelectMethod based on user input, which would call a different query. I have one textbox for input and several buttons to pick the type of filter.

My gridview populates on with the default selectmethod if I create a button that does nothing but a postback. My other buttons run the following codes which returns nothing. Any ideas what I'm doing wrong?

If

e.CommandArgument ="Last_Name"Then

EmployeeData.SelectMethod =

"GetDataByLastName"EndIfIf e.CommandArgument ="First_Name"Then

EmployeeData.SelectMethod =

"GetDataByFirstName"EndIf

gvPhoto.DataSourceID = EmployeeData.ID

gvPhoto.DataBind()

Thanks.

Lisa

Call EmployeeData.Databind() before the dvPhoto.DataBind()

Hope this help

Thursday, March 8, 2012

Changing queries for SQL Server 2000

I am currently using ASP as the front end and SQL Server 7.0 as backend. We are migrating SQL Server 7.0 to SQL Server 2000. How this will affect my queries used in the fron-end. Also as for as T-SQL is concerned what are all the changes happened in SQL Server 2000 (which is not there in SQL Server 7.0)?I think 2000 is pretty good backwards compatible with SQL 7.0 scripts, check out these pages for features in SQL 2K.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_00_1lbn.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag2k/html/CoolestFeatures.asp

http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/sql/reskit/sql2000/part1/c0261.asp

HTH