visual studio web page implementation

maks4life

New member
Joined
Aug 17, 2010
Messages
4
Programming Experience
Beginner
hi im new to this and wondering if ay1 can help me.
i have created a web page in visual studio 2008. The website is based on databases e.g entity relationship . it shows booking of a hotel with customer id etc.
i manage to get a add, delete and edit button to work on my website fo them databases but cant seem to understand this one:
producing a weekly booking list to be used by the hotel to show which guests are due to arrive within a seven day period to be input by the user. The list should show details of each room along with its occupants
 
web

ive tried buildin a query bt cnt seem to be gettin anywhere. most of it alll complete e.g the databases in my website bt the last thing is confusing me as to how can i show my booking on the weekly function
 
Basically, you just need to write a query that gets all the records where some date column falls between a start date and an end date. You then execute that and pass today as the start date and 7 days from now as the end date.
 
query

Basically, you just need to write a query that gets all the records where some date column falls between a start date and an end date. You then execute that and pass today as the start date and 7 days from now as the end date.

thats what i cant seem to understand. Keep getting stuck on the query and it wont execute it. is there any chance you cn give me the query
 
You use stored procedures very easily. Just assign the name of the SP to the command's CommandText
As you know the command text can be literal SQL or a stored procedure name. In your case we simply say:
VB.NET:
        Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Try
            connection.Open()
            Dim command As SqlCommand = connection.CreateCommand
            command.CommandType = CommandType.StoredProcedure
            command.CommandText = "storedprocedureName"
            Dim table As New DataTable
            table.Load(command.ExecuteReader)
            command.Dispose()
            ' do something with the datatable :)
        Catch ex As Exception
            Response.Write(ex.Message)
        Finally
            connection.Close()
        End Try

Now you have the retrieved data into DataTable so you can use it as datasource for your control(s)
 
Back
Top