StrataFrame Forum

Error executing Search code

http://forum.strataframe.net/Topic10031.aspx

By Robert Carl Johnson - 7/6/2007

Hi all. I have incorporated search in my maintenance forms using the technique from the turorial 6. Upon running I get an error:



{"Invalid object name 'tlbBarelLength'."}



Code under my search button:



Me.BarrelLgtnBO1.FillByLength(Me.txtSearch.Text)



My BO code:





Public Sub FillTop100()

Me.FillDataTable("Select TOP 100 * FROM tblBarelLength")



End Sub





Public Sub FillByLength(ByVal BarrelLength As String)

'-- Estabish Locals

Dim loCommand As New SqlCommand



'-- Build the query

loCommand.CommandText = "SELECT * FROM tlbBarelLength WHERE Length = @length"



'-- Add the parameter

loCommand.Parameters.Add("@length", SqlDbType.VarChar)

loCommand.Parameters("@length").Value = BarrelLength



'-- Execute the command to fill the business object

Me.FillDataTable(loCommand)

End Sub



Now the if the FillTop100 code works which is calling the same table object why is the FillByLength code inop?



Lost In Ventura....Pinch



Regards,



Robert




By Greg McGuffey - 7/6/2007

Table name is misspelled in second fill method (FillByLength)



{"Invalid object name 'tlbBarelLength'."}


indicates you misspelled the table name.





Public Sub FillByLength(ByVal BarrelLength As String)

....

'-- Build the query

loCommand.CommandText = "SELECT * FROM tlbBarelLength WHERE Length = @length" <-- should be tbl not tlb

.....

End Sub

By Robert Carl Johnson - 7/6/2007

I gotta tell you, the day started out with dumping coffee on my keyboard and it's been downhill since then.. um thanks Greg for spotting what I would have taken me all day to see.. Blush



Regards,



Robert
By Greg McGuffey - 7/6/2007

No problem...I've had a few of those kind of days myself. It's good to have the forum here to help us during those trying times! Hope you'll do the same for me some day! BigGrin
By Robert Carl Johnson - 7/6/2007

You can count on it Greg, assuming I know the answer.. lol. BigGrin



Robert
By Ben Hayat - 7/6/2007

Robert Carl Johnson (07/06/2007)
You can count on it Greg, assuming I know the answer.. lol. BigGrin



Robert




Greg, is a good man!
By Robert Carl Johnson - 7/6/2007

I'm sure he is... Everyone here has been good to me.. helping me along even on weekends. When I get up to speed I'll do my best to help others. In the mean time... lol.



Robert