urgent help needed in DataGrid & ComboBox
-
hello all, I have a data grid in vb.net 2003 connected to the database what I need is to select specific data by choosing the employeeID using comboBox e.g: comboBox: a.srour datagrid: view a.srour details ....
There are definately articles on the site for putting a combo box inside a data grid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
There are definately articles on the site for putting a combo box inside a data grid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
thank u Christian Graus, but what i want that the combobox outside the datagrid, it is a kind of filter. select a value from comboBox for its details to be viewed in the datagrid srour_costavo@hotmail.com
Oh, OK. That's even easier. You just handle the index changed event on the combo, and run fresh SQL to fill the grid based on the selection. The combobox lets you store a value that's associated with each string entry, so you can hide the Id you need in there.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Oh, OK. That's even easier. You just handle the index changed event on the combo, and run fresh SQL to fill the grid based on the selection. The combobox lets you store a value that's associated with each string entry, so you can hide the Id you need in there.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
ok man but the real problem is in the syntax, the concept is understood, the help I need is syntax help would u do that srour_costavo@hotmail.com
To be honest, I can't. How are you accessing your database ? What sort of database is it ? What value do you want to use to select your values ? What is your database schema ? I can't provide more direct help without all of that info, and if you can't do it, I'm wondering which bit you're stuck on ? Can you access your database at all ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
To be honest, I can't. How are you accessing your database ? What sort of database is it ? What value do you want to use to select your values ? What is your database schema ? I can't provide more direct help without all of that info, and if you can't do it, I'm wondering which bit you're stuck on ? Can you access your database at all ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
''The SQL select Command Private Sub conn() dt = ProfileDAO.ExecuteStrDt("SELECT [ComputerName], [Comming], [Leaving], [TotalTime], [IncludeTotalTime], [OverTime],[overtimeckh] FROM [HR].[dbo].[WorkingHours] ) DGtimeS.DataSource = dt End Sub ' I am Accessing the db without problems ' the comboBox is also connected to db and retriving data without problems Private Sub ttt1() Dim FullName1 As String Dim i As Integer dt = ProfileDAO.ExecuteStrDt("Select EmployeeID, FirstName, fatherName, LastName from Employees order by FirstName") Me.CmbEmployees.Items.Clear() With CmbEmployees For i = 0 To dt.Rows.Count - 1 FullName1 = dt.Rows(i)(1) & " " & dt.Rows(i)(2) & " " & dt.Rows(i)(3) .Items.Add(New Mylist(FullName1, dt.Rows(i)(0))) Next End With End Sub 'what i want is to connect the combo box and the data grid 'vb 2003 & sql 2000 is that possible & if u give me ur email i may send u code of the app
-
''The SQL select Command Private Sub conn() dt = ProfileDAO.ExecuteStrDt("SELECT [ComputerName], [Comming], [Leaving], [TotalTime], [IncludeTotalTime], [OverTime],[overtimeckh] FROM [HR].[dbo].[WorkingHours] ) DGtimeS.DataSource = dt End Sub ' I am Accessing the db without problems ' the comboBox is also connected to db and retriving data without problems Private Sub ttt1() Dim FullName1 As String Dim i As Integer dt = ProfileDAO.ExecuteStrDt("Select EmployeeID, FirstName, fatherName, LastName from Employees order by FirstName") Me.CmbEmployees.Items.Clear() With CmbEmployees For i = 0 To dt.Rows.Count - 1 FullName1 = dt.Rows(i)(1) & " " & dt.Rows(i)(2) & " " & dt.Rows(i)(3) .Items.Add(New Mylist(FullName1, dt.Rows(i)(0))) Next End With End Sub 'what i want is to connect the combo box and the data grid 'vb 2003 & sql 2000 is that possible & if u give me ur email i may send u code of the app
OK, so you have the employee Id in your combobox item. Now, pull it out of there when a selection is made, and write your SQL with a where clause that uses this Id to get only the data you need, and bind it to your grid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
OK, so you have the employee Id in your combobox item. Now, pull it out of there when a selection is made, and write your SQL with a where clause that uses this Id to get only the data you need, and bind it to your grid.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
I know that i am disturbing a lot, and i understood the concept very well but the real problem is that I DONT KNOW THE SYSNTAX to do what u are saying. my demand is the sentax bro. is that possible? srour_costavo@hotmail.com
TWo things 1 - no way do I give out my email address 2 - I cannot give you exact syntax. Like I told you, unless I see the schema of the DB, I don't know what it is. Why can't you work out the syntax ? Is it the SQL that you have trouble with ? b/c the data access code doesn't really change.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
TWo things 1 - no way do I give out my email address 2 - I cannot give you exact syntax. Like I told you, unless I see the schema of the DB, I don't know what it is. Why can't you work out the syntax ? Is it the SQL that you have trouble with ? b/c the data access code doesn't really change.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog