Showing posts with label datasourceselect. Show all posts
Showing posts with label datasourceselect. Show all posts

Thursday, March 29, 2012

Basic Question: Setting a varaiable to a datasource.select value

Hi!


I am trying to do something that I would think should be rather simple.

I have a SQLDataSource that has a simple select statement.

I have a String Variable st_temp

I know my SQLDataSource returns only one value, and it's a string.

HOW DO I DO somehitng like st_temp=SQLDataSource.Select;

I am getting nothing but errorrs

Thanks in advance

Dan

What errors are you getting?|||

If you are using just a single value then there is no need for SQLDataSource object. You can directly use SQLCommand.ExecuteScalar() method.

|||

2 things:

1. sorry to be so dense but how do I use SQLCommand.ExecuteScalar() method. in C#?

2. Errors are

":CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement" when I call SDSSelect.Select;

and

":CS0428: Cannot convert method group 'Select' to non-delegate type 'string'. Did you intend to invoke the method?" when I call Label1.Text= SDSSelect.Select;



Thanks again for the help...i shouldda stayed in Java land!|||

Thanks for all the HELP!!!

Dan