ADO.NET :: Store Max Value Of Table In Database To A C# Variable?
Mar 27, 2011I want to store a Max value of a table in sqlserver database to a C# Variable.
View 2 RepliesI want to store a Max value of a table in sqlserver database to a C# Variable.
View 2 Repliesi want to store Session["Name"] into databse "name" column. how to do this ?
View 1 Replies1.store them in the file system of web server and put the url in the table?
2.store them as type "image"?
3.store them as varbinary(max) BLOB?
4.store them as filestream data?
I have a web application which uses a session variable to store the logged in userid. If no user is logged in, of course this variable will be empty and the contents displayed on my website are meant for guests. If there is a user logged in, the user specific controls/access/links will then be a displayed.
I am now having issues with my hosting where on shared application pool, the worker recycle is triggered every 90 minutes, this will clear sessions causing all my users to be logged out. I opted for a dedicated application pool, which got worse because I am only allocated 50MB memory limit and if this is reached, the worker recycle is triggered and I lose my sessions again. I have tried as much as possible optimization techniques, e.g. dispose where possible, close connections, disable viewstate for static controls etc but my memory per instance keeps building up from page to page without any signs of improvement. I don't use loops nor store huge objects like bitmaps etc but my sessions are now gone even faster than 90 minutes in shared application pool before.
I have considered using SQL Session State but there isn't a simple guide on using this with MySQL. I am getting desperate and considering using a public variable, a string as a replacement to store logged in user id instead of in a session variable. I am pretty sure this will solve my issue with sessions being recycled but are there any negative consequences of doing this? One problem I can think of is if the user closes the browser, the system will never know that the user is now logged out and this public variable should be nothing. In this scenario, will the GC eventually clear this abandoned public variable.
I am trying to store data from an XML file to a table in my database, but I keep getting the same error.
This is my code from the cs file:
[Code]....
And this is my error:
Violation of PRIMARY KEY constraint 'PK_Areas'. Cannot insert duplicate key in object 'dbo.Areas'.
The statement has been terminated.
In my XML file I have both existing rows and new rows for the database table. I'm guessing I have to do something to sort out the the rows that are not already in the database, but so far I have been unsuccessful to figure this out.
In my form there are about 6 parameters and two of them have multiple values, upto 6. I'm imposed by the restrictions that I can't change the table structure. The table have 8 fields one for ID as primary key, one for foreign key and other to store data. The two fields which have multiple values are color and size. A size may have different colors and vice versa.
The programmer which have developed the site earlier used a stored procedure to store the data in database. And he implemented the above scenario one by one for each color/size. Now I have to put all in one.
How can I do this. As I can't change the table structure at current moment as this will disturb the whole E-commerce site.
I want to store Values in two table in database..
For Ex.
table 1-- Resi
if Resi is clicked then the values are stored in resi_db and then it will also get store in the HEG01_db table in database..
table 2-- NonResi
if NonResi is clicked then the values are stored in NonResi_db and then it will also get store in the HEG01_db table in database..
i have store data in the session and i want to insert that data to the database using sql server 2008.can i do this or not? if can, how can i?
View 1 RepliesOur application lets the administrator create new users. Since the administrator is logged in, I have set Logincreateduser = false so that the administrator is not logged out even after creating the new user.
The problem is :I need the userid of the newly created user to store additional details of the user in another database table. I see that i can get the username using Createuserwizard1.username; but how do I get the userID?
Currently in an .aspx file, I am storing a value (filename that was created in that session) in an hidden text box. When the user clicks on the "Print" labeled Hyperlink control, it opens the file that was stored in the hidden text box control. But when the user goes to different screen (in the same session), I loose the filename value that is stored in the hidden text box control. So I would like to store the filename variable in a session variable. So that if the user leaves this .aspx file and comes back to this .aspx file I can load the value into the hidden text box from the session variable.
View 11 RepliesI have a datalist that shows Label, Label2 and has 8 rows of data.
I would like to store the value in Label2 row 8 in a session variable... how can i do this in VB.net?
how could i store a Asp.net Application variable by javascript.
View 2 Replies[Code]....
Above is dynamic sql and when it is executed by sp_executesql then I got output as as xml. If I want to store that XML in a variable. So then what I need to add in my tsql script.
i am wishing to store the query result in any variable, have look at below code.
[Code]....
I have marked the code with bold, where I am getting error.
how do I store query result in any variable.
consider this scenario: a user on my website has a profileID. There are some pluginID's associated with this profileID.
E.g.: User1 might have 2, 3 and 5 plugins associated with his profile.
When the user logs in, I store the profileID of the user in a session variable cod. ON a certain page, the user tries to edit the plugins associated with his profile. So, on that page, I have to retrieve those pluginID's from the DB.
I have applied this code but this fetches only the maximum pluginID from the DB and not all the pluginID's.
[Code]....
I was trying to figure out how can I store multiple pluginID's in this session variable?
I wish to store some variables across my whole ASP.NET site, such as the site name/title and a multitude of others.
I wish to store them in an XML file with a name and value, and then insert them into the relevant place on the page using a tag like <% siteTitle %>.
How can I do this? I have seen similar with sites like SmarterMail and other ASP.NET off-the-shelf products, but they seem to use a value from their own DLL file, this is probably too much of a complex method, so I will need something simple like the XML method mentioned above. Having said this, I don't particularly want to use the AppSettings method.
How to store the values in array(variable) using textbox?..
View 7 RepliesI have 2 arrays declared like this :
[Code]....
and i wish to put both in one session variable and then retrieve it to get one array like:
{"intItemID","strCategory","strType"}
I'm looking store an ArrayList into a session variable, but am having a few problems. Can you spot anything wrong?
public partial class _Default : System.Web.UI.Page { ArrayList score = new ArrayList(); protected void twist2(object sender, EventArgs e) { int a = 11; int c = RandomNumber(a); score.Add(c); score = (ArrayList)Session["scoreData"]; Result.Text = (c).ToString(); String Result_id = Result.Text; int total = 0; //Session["scoreData"] = score; for (int i = 0; i < score.Count; ++i) { total += (int)score[i]; } Sum.Text = (total).ToString(); String Sum_id = Sum.Text; }
Is there a way how to capture only the picture from webcam and store that image into the variable. But i dont want to use silerlight nor flash.But if is not possible then i do need the step how to use in flash. I dont need good quality.
View 2 RepliesDim ename As String = DropDownList.SelectedItem.Value
this statement is'nt working
my JSON is as follows :
{ "Data":[ { "id":"1", "Name":"Sachin" }, { "id":"2", "Name":"Rahul" },
{ "id":"3", "Name":"Sovrav" } ]}
Now i want to filter out only array from that JSON and store them in a variable like this :
[ { "id":"1", "Name":"Sachin" }, { "id":"2", "Name":"Rahul" },
{ "id":"3", "Name":"Sovrav" } ]
Its related to datatable in gridview store in session and then session retrive and store to database. basically i am using gridview here creating new row for button click and these row adding untill user's last entry then submit all these entry to database. so i want to use session variable to store this data temporarily and after final entry user click on submit button and all data shold be save in db.
View 9 RepliesI have to build a screen that tracks despatched goods on trucks on a certain date. I have created a form (using C# and ASP.NET) where I am displaying the calendar and am allowing the user to select the date he wants to check for the despatched goods.
My question is how to store the date that was clicked by a user in a variable which I want to use it later in an SQL query.
Should I store the date as a session variable? Suppose I want to display the date that the user clicked, how do I display it?
the dropdown list is showing data from database, but how to retrieve the selected value and store it in a session variable??
View 1 Replies