Showing posts with label populated. Show all posts
Showing posts with label populated. 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

Friday, February 10, 2012

changing data types

hi!
I'd like to change the datatype of one tablefield from varchar to text.
Is this possible when the table already is populated, or will there be trouble?
obscurrDepending the version you're using.

In any way

exec sp_rename MyTable, MyOldTable
select Col1, Col2, convert(TEXT, ColVarchar) ColVarchar
into MyTable
from MyOldTable
drop table MyOldTable|||I'm using SQL Server version 7.0