sqldatasource

Why does the following bring back data only when both parameters are set?

The two procedures, SearchMaster and SearchDetails work if I run it in Sql Management Studio and SearchMaster even runs fine when I am Testing the Query when I set up the stored procedure in design view, but when I run it, no rows are created if I enter just info for the frn or business. If I enter for both, I do get data if there is a ...

Application Variable in SQLDataSource control parameter

Perhaps this is laziness on my part, but in the same way I can reference a connection string from my web.config using <%$ ConnectionStrings:con %>, I'd like to do similar referencing an Application variable in one of my select parameters. Something like: <asp:Parameter Name="AppVal" Type="Int32" DefaultValue="<% Application['MyVal'] %>...

How to handel exceptions with a SqlDataSource

Hi I have a SqlDataSource that is supplying data to my GridView. Thats all i am using on my form, thus i have NO code behind at all. But somewhere i need a TRY CATCH block just in case my connection get's lost. What code must i place where? If i get a error i want my lblMessage Text to be "No connection". Any help would be great! Reg...

SqlDataSource tag not picking up my selectparameter for some reason.

Hi, Here is my markup in my .aspx page, the sqldatasource is feeding my gridview: <asp:SqlDataSource ID="sds" runat="server" ConnectionString="server=blah;database=MyPortal;Integrated Security=FALSE;user=sa;pwd=123;" SelectCommand="GetUsers" > <SelectParameters> <asp:QueryStringParameter Name="PageIndex" Qu...

Dropdownlist AppendDataboundItems (first item to be blank)

Hi, I have a drop down list inside an update panel that is populated on postback from a sql data source. It has a parameter which is another control. I sometimes need multiple postbacks, but what happens is that each time the update panel refreshes, items are added to the dropdownlist. So the dropdown list ends up having data that is i...

Silverlight and SQLDataSource

Is it not possible to use a SQLDataSource in an aspx page inside a Silverlight application? ...

How to recycle data in an SqlDataSource object?

I have an SqlDataSource object, linked to a GridView, which receives data from a database when executed. I'd like to add the values of the "Cost" column, to get the "TotalCost", and place it in a TextBox or Label on top of the GridView. Is it possible to just use (recycle) the data in the SqlDataSource object, instead of using another ...

ASP.Net: drop down list and data source created dynamically

I have about 10 drop down list controls that get populated. Instead of copying/pasting and modifying a few fields on each, I would like to create them programmatically. Can this be done? Here is what one of them looks like. I would like to programmatically add 10 dropdownlist controls and their respective SqlDataSource controls. <...

Clear cache in SqlDataSource

I need to manually clear the cache on a SqlDataSource with caching enabled. I've tried setting EnableChaching = false, and CacheDuration = 0 (as well as = 1) and none seem to expire the content already in the cache - although they do seem to prevent new SELECTs from being cached. How do I manually expire that cache? Thanks. ...

Why isn’t ObjectDataSource’s matching algorithm as flexible as…?

Hello, Even though UpdateNames stored procedure only takes one parameter named @First, we are still able to define additional parameter named Last, and the update will still be successful: <asp:SqlDataSource ... UpdateCommand="UpdateNames" UpdateCommandType="StoredProcedure"> <UpdateParameters> <asp:Pa...

Getting the data retrieved by SqlDataSource (ASP.Net)

I have a SqlDataSource retrieve tabular data from a store procedure. How can I get to the data it retrieved in order to save it to the cache? ...

Any easy way to get row count in sqldatasource without writing any code?

I want to get row count of SqlDataSource after binding. ...

asp.net dropdownlist - add blank line before db values

Hi, On my page I have a dropdownlist which gets populated by database values from an SqlDataSource(see code) How can I add my own text or a blank line before the values... <asp:DropDownList ID="drpClient" runat="server" Width="200px" AutoPostBack="True" DataSourceID="dsClients" DataTextField="name" Da...

How can I set the sqldatasource parameter's value?

I'm trying to set the value of the sqldatasource's selectcommand parameter @ClientID as in the code below, but it's not working out. My code: Dim strCommand = "SELECT caller_id, phone, name, email FROM callers WHERE client_id=@ClientID" SqlDataSource2.SelectCommand = strCommand SqlDataSource2.SelectParameters.Add("@ClientID", iClien...

Why, if data source control is created via GridView’s Smart Tag, are parameters for…

Hello, 1) I’ve always manually created ( in source view ) data source control, but I noticed that when I define data source control via GridView’s Smart Tag --> Configure Data Source, then the corresponding markup ( which Asp.Net automatically generates for us ) for UpdateCommand, InsertCommand and DeleteCommand also includes declara...

asp:SqlDataSource to DataSet Items

Hi, I have an asp:SqlDataSource ID="SqlDataSource1" tool on my aspx page, what I want to do in the c# sharp code behind is transfer the records returned by the datasource and put them into a DataSet, so that I can add paging to my page, how do I do that, my attempts so far have failed?! My attempts so far have been along the lines of: ...

Problem with ASP:DataList control Databinding to SQL DataSource

I have a DataList bound to a SQL DataSource on my website. The DataSource has a view populating data to the control. I recently edited the View to contain a new column of data to use in my DataList, however when I go to reference it in the DataList I get a 'System.Data.DataRowView' does not contain a property with the name 'promo_tim...

Editable multicolumn primary key with ASP.NET's GridView and SqlDataSource

I have a table TaskSchedule. It has a three-part primary key and two more values: IdTask PK IdPerson PK StartTime PK EndTime Remarks IdTask and IdPerson are also foreign keys. The idea is that you can write down which person worked on which task in which period of time. We suppose that those three stuff will be sufficient to specify u...

.Net SqlDataSource tag SelectCommand

Hi, My question is in regard to the SelectComman in the <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:conStr %>" SelectCommand="SELECT * " + "FROM myTable"> </asp:SqlDataSource> Obviously I have given an example but why won...

Asp.net: how to use jolly char against an integer field for a query in a datasource

Hy guys, my question is: if i have in asp.net, a SqlDatasource or AccessDatasource with the following select command: SELECT * FROM Mytable WHERE SomeFieldID=@FilterID SomefieldID is an integer And i would like to use the jolly char (* or %) to show all datas... how can i do? Thanks to everybody will help... Bye Stighy ...