i have a table which has attributes such as fname,lname and address.i can show the details of all these attributes togheter with tablegridview and other data objects but I cant access to specific attribute.for example I want to show just the fname in the texbox1.what is the command
my namespace is noise but my database name noise2 .there are two table . i want to connect with noise2 but get some error like the name"lbltxtname" does not exist in current context. what can do now ??
You won't get far without some basic knowledge. Copy/pasting code from a forum on each new task you have to do will become frustrating quickly, for both of us.
FWIW; you do not 'connect' a label with a table. A label can be used to display something. You can fetch values from a database using the IDbConnection classes (see System.Data), and one can display that data in a label.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
It's two SQL queries. The first updates the maxValue record, and then the second one selects this value out of the table. I suspect that you are running this inside a single transaction because this is a common technique when you need to manually generate a key. Effectively, what this does is lock the record on the update so that you can then select the value you just updated, rather than getting a random value out based on the selection of a maximum value in a multi-user system.
Now, some things you need to know about posting here on Code Project.
You need to pick the right forum to post a question in. This question has nothing to do with C# - it's a database query, so it should be asked in the database forum.
You need to pick meaningful titles. The title you put down here is worse than useless.
When you present code, wrap them in pre blocks. Once you've typed your code in, highlight it and then press the code button above the textbox. This allows you to select the language you want to use.
Don't double post questions.
Finally, you'll find you get on better if you take the opportunity to say please and thank you.
I was brought up to respect my elders. I don't respect many people nowadays.