I have know solved the syntax error in the FROM clause.
I have been trying to solve No value given for one or more required parameters, but have not been able to solve it.
Could anyone please give me a suggestion. Error happens on da.Fill(ds, "RoyalYachtingAssociation2")
I have tried changing the SQL statement but this does not seem to affect it. I have checked all field names and they are correct.

Dim SQL As String = "SELECT BoatDefectLog.BoatDefectLogID, BoatDefectLog.HullNumber, BoatDefectLog.Defect, BoatDefectLog.DateReported, BoatDefectLog.Repaired, BoatDefectLog.DateRepaired, Owner.FirstName, Owner.Surname, Owner.Address, Owner.PostCode, Owner.RYAMembershipNumber, Owner.PositionInClub, Owner.MemberID " & _
" FROM Owner, BoatDefectLog WHERE Owner.MemberID = BoatDefectLog.MemberID AND Surname = '"

userInput = TextBox1.Text
SQL = String.Concat(SQL, userInput)
SQL = String.Concat(SQL, "'")


da = New OleDb.OleDbDataAdapter(SQL, con)
da.Fill(ds, "RoyalYachtingAssociation2")
Dim dataAdapter As New OleDb.OleDbDataAdapter(commandString, con)
dataAdapter.Fill(ds, "RoyalYachtingAssociation2")
FillControls()
End Sub

Recommended Answers

All 5 Replies

I have been trying to solve No value given for one or more required parameters, but have not been able to solve it.
Could anyone please give me a suggestion. Error happens on da.Fill(ds, "RoyalYachtingAssociation2")

So what is 'ds' and what value does it have?

ds is the dataset as I have defined it as Dim ds As New DataSet
I think the value is the surname which I type into a textbox.

Apparently not. Post the code where you assign a value to the dataset ds. Use [code=vb] 'your code here [/code] tags when you post code

And DO NOT send me pm's for help. It gets me very irritated ..

Hi, Sorry for sending you a pm.
Below is the code I have showing the declaration of the ds.

[/Public Class SearchInBDAOTRpt
Dim con As New OleDb.OleDbConnection
Dim userInput As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim commandString As String = "SELECT Owner.MemberID, Owner.FirstName, Owner.Surname, Owner.Address, Owner.PostCode, Owner.RYAMembershipNumber, Owner.PositionInClub, BoatDefectLog.BoatDefectLogID, BoatDefectLog.HullNumber, BoatDefectLog.Defect, BoatDefectLog.DateReported, BoatDefectLog.Repaired, BoatDefectLog.DateRepaired FROM Owner, BoatDefectLog " & _
"INNER JOIN ([Owner] INNER JOIN [BoatDefectLog] ON Owner.MemberID=BoatDefectLog.MemberID" & _
"ON MemberID.Owner = MemberID.BoatDefectLog) "

Dim MaxRows As Integer
Dim inc As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\RoyalYachtingAssociation2.mdb"
con.Open()

Dim SQL As String = "SELECT BoatDefectLog.BoatDefectLogID, BoatDefectLog.HullNumber, BoatDefectLog.Defect, BoatDefectLog.DateReported, [/BoatDefectLog.Repaired, BoatDefectLog.DateRepaired, Owner.FirstName, Owner.Surname, Owner.Address, Owner.PostCode, Owner.RYAMembershipNumber, Owner.PositionInClub, Owner.MemberID " & _
" FROM Owner, BoatDefectLog WHERE Owner.MemberID = BoatDefectLog.MemberID AND Surname = '"

userInput = TextBox1.Text
SQL = String.Concat(SQL, userInput)
SQL = String.Concat(SQL, "'")


da = New OleDb.OleDbDataAdapter(SQL, con)
da.Fill(ds, "RoyalYachtingAssociation2")
Dim dataAdapter As New OleDb.OleDbDataAdapter(commandString, con)
dataAdapter.Fill(ds, "RoyalYachtingAssociation2")
' FillControls()
End Sub]

Dim ds As New DataSet .... da.Fill(ds, "RoyalYachtingAssociation2")

As I suspected. Between the declaration and using 'ds' it never gets a value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.