|
In the site I have a file to store an integer.In a asp.net page I have I read this file and let the user create a record in the database table and after addition the integer in the file is increased by one. I need the integer stored in table to be unique. What I worry about is if multiple users open the same page and both will have the same integer(read from file). Should I use lock for the file ? What is your recommendations ??
|
|
|
|
|
If you only want the id in the database table to be unique, that's best handled in the database.
Set the field in the database to be identity , counter or auto_increment , depending on the database you are using.
After you have create the record in the database, you can get the identity that was created, for example using "select scope_identity()" if you are using MS SQL Server.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Guffa wrote: Set the field in the database to be identity
My table already has an identity column. is it possible to create two identity columns for a table ?
|
|
|
|
|
No.
Create a new table with just an identity field, and use that to create unique values, instead of trying to use a text file.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
i need to add an icon to my web pages i used the following
but it did not work
please advice,
thanks in advance
abdelhameed81
|
|
|
|
|
abdelhameed81 wrote: but it did not work
It depends on browser. I think IE7 onwards displaying this. IE6 won't display this
|
|
|
|
|
Minor correction: IE6 will show it if you bookmark it and then revisit the page. Which is a bit rubbish.
Cheers
Ben
|
|
|
|
|
Hi
I'm working with webparts controls.I have created a declarative catalog part and placed a dropdownlist to that catalog also have added some three items to that dropdownlist during design time. But in run time when i add that dropdownlist from the declarative catalog to a webpartzone. The control alone get's inserted the items added to it during design time are missing.. Why is this happening....?
-- modified at 9:44 Tuesday 23rd October, 2007
Regards
Sivan.G
|
|
|
|
|
I designed a webpage in asp.net with c#,for online shopping.in that the list of products(images) are displayed.at first the images size are small in size. when the user move the mouse over the particular product, the particular product image size should be en-large and it is shown as big image. how it is possible. please help me.
jai prakash
|
|
|
|
|
|
thanks navaneeth.
jai prakash
|
|
|
|
|
Hi,
I am trying to repeat image in word (containing HTML) for some table cells. But the image is not displayed in MS Word. It displays in IE / other browsers. I am using background-image and repeat x for this.
I searched for the same and found that background images are not supported in MS Word. Is there any workaround for this.
Thanks !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hi Guys and Gals,
I am using a javascript function to update a label in a template column of a gridview. This all works fine, but the problem we are having is that when we want to update the database with the changes, the labels returns the old values instead of the updated values in the labels.
Here is our JavaScript. If anyone can tell us what we are doing wrong or how to correct this problem, it will be greatly appreciated.
string script = @"
function calcQty(QtyPerCarton,Cartons, num)
{
if(num < 10)
num = '0' + num;
var i = document.getElementById('dg3_ctl'+num+'_txtCartonsPicked');
var carPicked = i.value;
var out;
if(carPicked <= Cartons)
{
out = parseInt(carPicked * QtyPerCarton)
}
else
{
alert('Cartons Picked cant be greater than Cartons');
return;
}
var lbl = document.getElementById('dg3_ctl'+num+'_lblQtyPicked');
lbl.innerHTML = out;
}
";
this.RegisterStartupScript("Calc", script);
Kind Regards,
Elizma
|
|
|
|
|
Use this:
lbl.value= out
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
It doesnt work! Visual Studio generates tags in the html output, thus it will not contain the value attribute but only the innerHTML attribute which does not change or update the old value with the new value.
Any ohter suggestions?
Kind Regards,
Elizma
|
|
|
|
|
if lbl is not a server side control then how you can access it server side in code behind for save to the Database?
Note: you can once more test with lbl.innerText=out;
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
My Label is a Server side control since it's a Template field of the GridView. The code I am doing is in Javascript that updates the values client-side. Unfortunately the client-side values does not get sent back to the server for saving.
Tried innerText as well. Still not working.
Regards,
Elizma
|
|
|
|
|
What do you want exactly? Do you those values prepared by JS to the updated in DB?
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
I have a gridview. In my gridview I have static data, a textbox column for entering the amount of cartons picked, a label to display the value of the amount of cartons picked / the qty per carton. The javascript takes care of this and display the values in the grid.
So, now I have a save button in order to update this data back into the database with the new QtyPicked. Unfortunately the html (if you go to view source) didn't update the old values with the new values. I need the new values to be sent to the database.
Any idea what else I can try?
Regards,
Elizma
|
|
|
|
|
I hope you are trying to update values in Gridview's edit mode. If so use #Bind("colname") for the textbox. Hopefully this may solve. But as far as I now if you are placing values from js they do not persists. Lets first try with bind. If does not we need to look for some work around for it.
Intelligence is measured by common sense not by how many scholarly books you read.
|
|
|
|
|
Hi,
Instead of giving update button in the each row of grid u can give a button for updation.In the click event of that button u have to check for the value which is changed in text box.Then u can use button.attribute.add("onclick","JS function") to bind with server these values.Hope this will
help u
Regrds
Lijo
|
|
|
|
|
AFAIK, updating the labels on client side does not go back to server. You can keep a hidden field for the same thing and update both the label and the hidden field. On the server get the updated value from the hidden field and save it to the DB.
-----
|
|
|
|
|
I Would suggest to use AJAX.
|
|
|
|
|
Hello,
I have a question and I hope you can help me.
I'm working on MOSS (Office Sharepoint Server) 2007 portal and made it multi lingual using the Labels. I have two languages Arabic and English. To make the user able to switch between the two languages I used the control "Variation Label Menu".
Now my question is: How can I change or customize the look of this control? i.e: Change it from the drop down menu style to just one language selection.
Take a look at this portal and see what I mean about the language selection: http://jo.zain.com OR http://www.alphamosaik.com
Really looking forward for your reply to tell me how I can achieve this.
Thanks in advance.
|
|
|
|
|
I m creating a table with so many different controls in it but this table is to be created at run time it was been done by me but i was unable to maintain the value of the controls which one is to be inserted by the user and the page was post back. so pls give me the solution for that. I want the proper way to maintain the value of the controls like textbox and combo and checkbox because i also store it into the database and also retrive it to the form back. I m putting my code on the page load event but the page postback property is false because i need like this and pls keep in mind one thing that the table is created by the code only and i have to trace the control and while the page is postback at that time the table value lost so i required this from u.
Hiren Dave
|
|
|
|