|
|
this question is for C#. I dont know how to put a value into a label my select statement works because Ive tried it on a listbox heres the code
select sum() from table where id = id
then: label.text = ?;
I tried dataset.tables[0].rows
but Im not to shure about that please help me.
|
|
|
|
|
dataset.tables[0].rows[0], I reckon.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I did but it just shows System.data...
in my select statement I have select sum() as total from
dont I have to put that total in somewhere?
|
|
|
|
|
lourensG wrote: dont I have to put that total in somewhere?
That's what the select did. I thnk you need to add .Value or something like that.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: dataset.tables[0].rows[0], I reckon.
I think it has to be dataset.tables[0].rows[0].ToString();
Also, not more than 4 threads down you have the EXACT same thread, with answeres in it for you. Why did you start a new one, people can still see that. It just makes you look impatient and rude. Read the forum rules
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
try this .....
dataset.Tables[0].Rows[0][0].ToString();
surely work......
|
|
|
|
|
thanks that works perfectly but how does Rows[0][0] work
|
|
|
|
|
lourensG wrote: thanks that works perfectly but how does Rows[0][0] work
Rows is the collection of all rows in your datatable. The first [0] is the row specifier. So lets say you have
Justin Perez
Lourens G
Titus Perez
Rows[0] Will return the first Row, containing Justin Perez. The second specifier is for which column you would like to retrieve. So Rows[0][1] Will return Perez. First row, Second column.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Hi,
I have this simple board game, has a form object which holds all other objects in it, the board being one of the objects added as a control to the form. Now I want to let the form know when something specific happens on the board (to adjust the score label which is on the form as a control as well).
Thanx
|
|
|
|
|
|
Worked like a charm!! Thanx a lot for the short yet comprehensive article
|
|
|
|
|
hello
I am debutant in C #, and I would like create a Windows application which makes it possible to manage a data base.
charge information in textBoxs, button first , previous, last, and allow the modification, the suppression.
thanks for help
|
|
|
|
|
almora007 wrote: thanks for help
Since you didn't actually ask a question, I'm curious about what help you expect.
Going by your description you have given an overview of the application you are planning to build. You haven't identified any specific problem areas. What would you like help with?
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
thank for your response
i see your point.
i explaine my probleme,
i have my database table and i dont now how to bind button te permet the user of the application traversing the table.
|
|
|
|
|
almora007 wrote: i have my database table and i dont now how to bind button te permet the user of the application traversing the table.
You can't bind a button to do that. You have to create an event handler for the button and then write the code to traverse the database.
To create an event handler: Double click the button in the designer. Visual Studio will create an event handler if one does not already exist and take you to that code. You then have to fill in the code yourself.
It is up to you how you want to traverse the data. I'm guessing you have a DataSet somewhere with a populated DataTable in it. You need to store a index to the row in the table somewhere and when the button is pressed the index is updated, you can then get the data from the row at the new index and populate your texts boxes and other controls.
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
|
Hi there, how do you insert data from an access database into a label I have a select sum statement and want to insert that value into the label please help. thanks
|
|
|
|
|
|
|
He assumed you were asking an ASP.NET question. As it stands, I'm not sure where the issue is. A label has a Text property. Do you not know how to query your database ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am doing it in C#, and I did a test to insert that value into a listBox and it worked I just want to know how to insert it into a label.
|
|
|
|
|
myLabel.Text = someValueFromTheDatabase;
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
I also need to write a select sql statement which searches through a number of tables. As a start I ahve this which doesn't work.
string sql = "select employees.Firstname from employees where employees.Firstname = '" + empNamecomboBox.SelectedValue.ToString() + "'"; where RoleID = '" + rolecomboBox.SelectedValue.ToString() + "'";
I've got a winform with 5 fields, either comboboxes or checkedlistboxes.
i want to find all employees where a role or/and manager and/or division is selected. In other words I want to find all employees who are a developer with certain skills.
At the moment I can only get them working one at a time but the search doesn't display employees, it just displays the data on the role itself, or the division itself if that makes sense. ?
|
|
|
|
|
1. Don't mark your questions as urgent - do you think anybody cares?
2. The snippet you posted will not even compile.
3. If you want to test it, set a breakpoint, see what your query comes out like, and try executing it from Query analyzer.
4. Use stored procs or at least parameterized queries - you are exposing yourself to SQL injection attacks.
Cheers,
Vıkram.
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|