I am trying to pass a variable into an sql statement am I going about this in the right fashion?I have declared a searchDate variable Dim searchDate As Date ' a date varable to combine with sql and be used for seacrh
I then assign todays date to the variablesearchDate = DateTime.Now.ToString("dd,MMMM,yyyy") 'assigns the current date to search date upon page_loadAnd now I want to pass the variable into the sql statementSELECT Booking.BookingDate, Room.RoomName, Booking.ClientName, Booking.StartTime, Booking.EndTime, Booking.Subject FROM (Booking INNER JOIN Room ON Booking.RoomID = Room.RoomID)
Now this is where I run into errors, I want to add to the statementWHERE Booking.BookingDate = the dateSearch variableI have tried:WHERE Booking.BookingDate = searchDateThis returned the following error:No Value given for one or more required parametersI am using VS2010 and sql server 2008