DataSource Controls :: Disable SQLDataSource Caching?
Aug 9, 2010What am I missing here? The data is being cached and I need to turn it off.
[Code]...
What am I missing here? The data is being cached and I need to turn it off.
[Code]...
I am trying to tie a sqlDatasource to a Stored Procedure. The stored procedure looks like...
[Code]........
I have checked this thread. [URL]
And wondering if I can put the answer inside page_load ?
If not how do I disable the cache on for a single page?
I currently cache everything possible on my site (images, JS, CSS). There is only one JS file that I need to be loaded fresh every single time. How do I omit just one file from caching, using web.config, whilst leaving everything else cached?
Note that I tried another link here, and it didn't seem to stop the caching of my file: How do I disable caching of an individual file in IIS 7 using weserver config settings
I have a .swf flash gallery that loads pics from a XML file.the probelm is when I modify the XML the modifications do not reflect on the flash till I delete the browsing cache from the browser
I tried to disable caching using code like this
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.AddHeader("Pragma","no-cache");
Response.Expires = -1;
but not working
i have two sqldatasource controls. one i use to display data in textbox's ,filter'd by a select parameter in page behind code. Once checked, i want to copy this data to the other datasource ,by selecting checkbox.Then display this data in detailsview control.
At present the two datasource controls declared , render data to the page simultaneously during pageload. I want to first check data in textbox's from first source, before second datasource is rendered to screen. note, both are filtered by a page variable. i wish to leave the textbox datasource control in situ, as other controls and code depend on it.The other detailsview datasource is my problem?
how to disable caching on few pages, so as to avoid double submission of forms
View 2 RepliesI have asked similiar question before where I have two control on the page header says "username" and "gender". User can select both the control or either one and the page will execute searching based on the criteria supplied. So if username supplied
SELECT * FROM [this_table] WHERE username = @username
and if gender supplied
SELECT * FROM [this_table] WHERE gender = @gender
and if both supplied
SELECT * FROM [this_table] WHERE username = @username AND gender = @gender
I know this sounds not very complicated but in my case, I am having like more than 10 controls up there. It is something likeusername, gender, age, date of brith, title, father name, frst name, last name, blur blur blur and it's a lot then I started to lost. if i were to use if else caluse on code-behind and produce query, it would end up writing a lot of if-else and if i use stored procedure (with if-else) then my stored procedure would contains a lot of if-else statement. I am fairly new to this concept and if I'm on the wrong track, please correct me. Is there any better way to save my hair without actually going through each
if-else statement to build the query ?p.s. I'm using GridView and SqlDataSource command to display the result back on .aspx page.
I am trying to check whether a username exists in my database before inserting the new row & display a message to the user if it does.
On my SqlDataSource my InsertCommand looks like this:
InsertCommand="IF NOT EXISTS (SELECT * FROM Users WHERE UserName = @UserName) BEGIN INSERT [Users] ([UserName], [FirstName], [LastName], [City], [State], [Country], [CompanyName], [Active], [PasswordHash]) VALUES (@UserName, @FirstName, @LastName, @City,
@State, @Country, @CompanyName, @Active, @PasswordHash) END"
This works as expected: If the username is unique, the row is created.
If the username already exists, the row is not added.
The problem is, if the row already exists, the insert is rejected but the user is not notified.
So my question is, is there a way I can notify the user?
Maybe something like: InsertCommand = "If Not Exists (select....) Begin Insert...Else Notify User Somehow End This is a basic database, I'm not using the built-in membership provider nor will be.
How do I programmatically add ParameterCollection ?
[Code]....
i use below sqldatasource for search within a gridview and it is working fine.i just add this control and set gridview datasource id to sql datasource id .but i need the same in codebehind dynamically.i need like this becuase i need to search in three textbox but before i use one textbox. so could someone show me a example how i add a sqldatasourse in code behind and set filter parameter for search from a gridview.
[Code]....
Which one is better for me to store urls of my products images while i was trying to bind images with gridview. provide me some code snippet to bind images to gridview with XMLDataSource.
View 3 RepliesIf I have a SqlDataSource like this one, is it possible to add a DataRelation in the sqldatasource? Or do I need to create a DataSet and add the Relation in CodeBehind?
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CString %>"
SelectCommand="SELECT * FROM table">
</asp:SqlDataSource>
I have a gridview with a sqldatasource with SelectCommand as below:
[Code]....
but it's not workling.....
i have an SQLdatasource in my page
i was trying to modify it as:
SQL.SelectCommand = "Select * from " + TXT_Tabella.Text;
because i want update dinamically my sql server tables but ,every time i am going to sort, or change page the selectCommand returns as before!
viewState is true! how can i have an SQLdatasource dinamyc by tableName? and how this problem occurs?
What is the best way to put a Greater than sign in an SqlDataSource
The code will run but it is underlined with an error "Attribute values must be enclosed in quotation marks."
Sample code looks like this...
SelectCommand="Link.Section, Link.PostDate.....
WHERE...
and (PostDate <= GetDate()) and (isnull(postremove, getdate()) >= getdate()))">
I need to get one record from rows. For example:
DB:
id, name, age, nick, gender , etc...
1, John, 18, gobb, M, ....
2, Andrew, 22 , AND, M, .....
3, Simon, 35, Lucky, M, ......
How to Get name (For example Simon) from DB and enter it into label? Or perhaps this is impossible?
I need to set the SQLDataSource connection string on the fly. Right now, this is what I have:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
OnSelecting="SqlDataSource1_Selecting"
SelectCommand= (working select stmt here)</asp:SqlDataSource>
Then, I have this:
[code]....
I'm using MikesDotNettings([URL] code mentioned: Bind Data From a SQLDataSource to a Label, and I'm getting this error:
"An SqlParameter with ParameterName 'ID' is not contained by this SqlParameterCollection."
This is what I have, I'm using my own data to try and populate the labels:
[Code]....
I need to assign the values to a labels (strings) as I need to use them for another caluculation.Can you or anyone looking at this figure this out?
I have an SqlDataSource query that should use an input parameter for multiple integer values, like:
select * from table1 where TableID IN (1,2,3,4,5)
->
select * from table1 where TableID IN (@IDValues)
How do I do that ? Default parameter settings won't work, returning "invalid integer value" . I suppose that parameter should be passed as some kind of array that SQL recognizes as multiple integer values , but what's the correct way of setting this ?
i want to ask how to i set variable in asp:sqldatasource in sqlcommand in asp.net c#....
This is my code
asp.net
<dx:ASPxListBox ID="lsAssignToko" runat="server" DataSourceID="SqlDataSource6"
TextField="NAMA" ValueField="ID" AutoPostBack="true"
EnableCallbackMode="True" SelectionMode="CheckColumn"
OnSelectedIndexChanged="lsAssignToko_SelectedIndexChanged">
<Columns>
<dx:ListBoxColumn FieldName="ID"/>
<dx:ListBoxColumn FieldName="NAMA" />
</Columns>
</dx:ASPxListBox>
<asp:SqlDataSource ID="SqlDataSource6" runat="server"
ConnectionString="<%$ ConnectionStrings:Ora2010 %>"
ProviderName="<%$ ConnectionStrings:Ora2010.ProviderName %>"
SelectCommand="SELECT ID, NAMA FROM REF_TOKO WHERE ID IN ( :inTOKO ) ORDER BY NAMA">
<SelectParameters>
<asp:SessionParameter Name="inTOKO" SessionField="inTOKO" Size="200" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
c#
string dummy = "";
string data = "";
string inTK = "";
string inTOKO = "";
//string inTOKO1 = "";
int pot;
for (int i = lsToko.SelectedItems.Count - 1; i >= 0; i--)
{
string tok = lsToko.SelectedItem.Text.ToString();
data = lsToko.SelectedItem.Value.ToString();
dummy = dummy + "" + data + ",";
int index = lsToko.SelectedItem.Index;
lsToko.Items.RemoveAt(index);
}
if (lsToko.SelectedItems.Count <= 1)
{
inTK = dummy.Length.ToString();
pot = int.Parse(dummy.Length.ToString()) - 1;
inTOKO = dummy.Substring(0, pot);
}
Session["inTOKO"] = inTOKO;
the problem is where in my variable inTOKO consist of couple of value...
Example
while variable inTOKO = one value success but while value inTOKO = two value error
inTOKO = 1101111 => success
inTOKO = 1101111,1211321 => not success
Im currently filling a dataset using an SqlConnection and a SQLDataAdapter:
[Code]....
This method is causing other sql connections to timeout. What I would like to do is an SQLDataSource to fill the dataset. Is this possible?
It seems really easy to output a sqldatasource into a table but really hard to output a sqldatasource into a variable.
View 2 RepliesI have an editable grid where user can add/edit data. They also have the option to load previously entered data from last month. When the user then clicks save, i want to readd this newly modified data as a new record for this month. So basically I want to call the insertcommand, but it does not work. My 'save' method just 'updates' the records.
Providing sqldatasource, grid and save method
<asp:SqlDataSource ID="SqlDataSourceLoadActivities" runat="server" [code].....
I use MySQL database and SqlDataSource controls. I generate update and insert queries in my code behind.how I can get a list of columns from the SqlDataSource control?
View 2 Replies