hey guys this is my first post,
I'm making a program that lets you see all available prodcts from a database just by making your picks
There is nothing wrong with my SQL cause it works in my ACCES2010 dataase but when VB.net uses that SQL he fails
Could you guys please help me
this is my code :
This is my database

I'm making a program that lets you see all available prodcts from a database just by making your picks
There is nothing wrong with my SQL cause it works in my ACCES2010 dataase but when VB.net uses that SQL he fails
Could you guys please help me
this is my code :
If TxtCPUD.Text = "" Or TxtCPUD.Text = "0" Then
CPUD = "*"
Else
CPUD = TxtCPUD.Text
End If
If TxtRamD.Text = "" Or TxtRamD.Text = "0" Then
RAMD = "*"
Else
RAMD = TxtRamD.Text & "*"
End If
If TxtHDDD.Text = "" Or TxtHDDD.Text = "0" Then
HDDD = "*"
Else
HDDD = TxtHDDD.Text & "*"
End If
If TxtSSDD.Text = "Ja" Or TxtSSDD.Text = "ja" Or TxtSSDD.Text = "JA" Then
SSDD = "True"
ElseIf TxtSSDD.Text = "Nee" Or TxtSSDD.Text = "nee" Or TxtSSDD.Text = "NEE" Then
SSDD = "False"
Else
SSDD = "False"
End If
If TxtGrafaD.Text = "" Or TxtGrafaD.Text = "0" Then
GrafaD = "*"
Else
GrafaD = TxtGrafaD.Text & "*"
End If
If TxtPrijsD.Text = "" Or TxtPrijsD.Text = "0" Then
PrijsD = "*"
Else
PrijsD = TxtPrijsD.Text() & "*"
End If
If TxtOSD.Text = "" Or TxtOSD.Text = "0" Then
OSD = "*"
Else
OSD = TxtOSD.Text & "*"
End If
dbprovider = "PROVIDER=microsoft.ACE.OLEDB.12.0;"
dbsource = "Data Source = CoppensHofman.accdb"
conD.ConnectionString = dbprovider & dbsource
conD.Open()
sqlD = "SELECT * " & vbNewLine & "FROM TblDesktops " & vbNewLine & "WHERE CPU Like '" & CPUD & "' AND Ramgeheugen >= '" & RAMD & "' AND HDD >= '" & HDDD & "' AND SSD = " & SSDD & " AND Videokaart >= '" & GrafaD & "' AND Besturingssysteem like '" & OSD & "' AND Prijs >= '" & PrijsD & "'" & vbNewLine & "ORDER BY TblDesktops.Naam;"
daD = New OleDb.OleDbDataAdapter(sqlD, conD)
daD.Fill(dsD, "desktops")
maxrowsD = dsD.Tables("desktops").Rows.Count
conD.Close()
MsgBox(sqlD)
MsgBox(dsD.tables("desktops").rows(MaxrowsD-1).item("naam")
This is my database

Last edited by a moderator: