Question Display problem in datagridview

sahar

New member
Joined
Feb 25, 2014
Messages
3
Programming Experience
Beginner
Hello everyone,
first of all i hope you're doing well. :sneakiness: ..... So i'm a beginner at vb.net and i have to realize a software for my company: An inventory management . I have two tables
* Inputs which contains (date, id spares, description, price, and quantity)
* outputs which contains also (date,id spares, description , price and quantiy)

i create another table "movments" which is the combinisation of the two tables (inputs and outputs) i wanted to drag:[inputs',outputs' date -spares' ID -inputs'/outputs' quantities] and create a new field "Quantities in stock". My problem is, that the table movments doesn't show in the datagridview. Can anyone help me please? :blue::blue::blue:

PS: i tried the code in access 2007 and it works perfectly , so i don't konw what's the problem in vb (i work with visual studio 2010 professional)

Here's my code:
Public Sub datagridshowentr?sortie()
Dim ds As New DataSet
Dim dt As New DataTable


ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter


da = New OleDbDataAdapter("SELECT ([Les entr?s].[Date_et_heure] AS [Date entr?],[Les entr?s].[R?f?rence_pdr],[Les entr?s].[Quantit?_pdr] AS [Quantit? entrante],[Les sorties].[Date_et_heure]As[Date sortie],[Les sorties].[Quantit?_pdr] AS[Quantit? sortante])" & _
"FROM [Les entr?s],[les sorties],[Les mouvements]" & _
"where [Les entr?s].R?f?rence_pdr=[Les sorties].R?f?rence_pdr", con)


da.Fill(dt)


DataGridViewX2.DataSource = dt.DefaultView


End Sub



 
For future reference, please use appropriate formatting tags when posting code snippets. Just post your code as plain text like so:

[xcode=vb]your code here[/xcode]

As for the question, are you actually saying that you have a third table in your database that duplicates the data in the other two?
 
Well, that's bad then. You should absolutely not be duplicating data in a database. You should revisit that design and expose the combined data via a query that combines the data from the single source. You can use a view or a stored procedure or an inline query but don't duplicate that data.
 
Back
Top