hi
i had got a problem that
i want to display the difference between two dates to be displayed in a grid view ,here the first date can be taken from a textbox.
when the button is clicked the difference between dates to be displyed in days,
here iam using the sql query as
SELECT DATEDIFF(dd, date_of_arr, date_of_dept) AS DAYS
FROM guesthouse
WHERE (date_of_arr = '" & arrivaldate.text & "')
and the button click event code is as below
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connstr As String
connstr = ConfigurationManager.ConnectionStrings("guest1").ConnectionString()
Dim conn As New SqlConnection(connstr)
Dim ds As New DataSet
Dim da As SqlDataAdapter
Try
da = New SqlDataAdapter("select datediff(dd,date_of_arr,date_of_dept) from guesthouse where date_of_arr='" & arrivaldate.Text & "'", conn)
da.Fill(ds, "questhouse")
GridView1.DataSource = ds
Catch ex As Exception
End Try
End Sub
but the code is not properly working
here button click event is not working.....
it automaticalyy shows dys but doesnot working the where condition.....
here the error is getting as
"Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition."
pls give me the answer........