in my windows form i have a datetimepicer.
i want when i select a specific date from it then run a stored procedure and populate the datagridview.
i am not getting any recored when i select the date from datetimepicer.
my database is sql server.
sample LogDate data:
5/16/2013 11:20:26 AM
5/16/2013 11:20:46 AM
5/16/2013 11:20:50 AM
5/16/2013 11:21:06 AM
---------------------------------------------------------------------------------------------------------------------------------------------------
Using connection As New SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=XXX;Data Source=192.168.0.1"),
command As New SqlCommand("SelectDeviceLog", connection),
adapter As New SqlDataAdapter(command)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@LogDate", DTP1.Value.Date)
Dim table As New DataTable
adapter.Fill(table)
DGV1.DataSource = table
End Using
--------------------------------------------------------------------------
-------------------------------------------------------------------------
ALTER PROCEDURE [dbo].[SelectDeviceLog]
@LogDate datetime
AS
SELECT UserId, LogDate from DeviceLogs
where LogDate = @LogDate
return
--------------------------------------------------------------
i want when i select a specific date from it then run a stored procedure and populate the datagridview.
i am not getting any recored when i select the date from datetimepicer.
my database is sql server.
sample LogDate data:
5/16/2013 11:20:26 AM
5/16/2013 11:20:46 AM
5/16/2013 11:20:50 AM
5/16/2013 11:21:06 AM
---------------------------------------------------------------------------------------------------------------------------------------------------
Using connection As New SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=XXX;Data Source=192.168.0.1"),
command As New SqlCommand("SelectDeviceLog", connection),
adapter As New SqlDataAdapter(command)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@LogDate", DTP1.Value.Date)
Dim table As New DataTable
adapter.Fill(table)
DGV1.DataSource = table
End Using
--------------------------------------------------------------------------
-------------------------------------------------------------------------
ALTER PROCEDURE [dbo].[SelectDeviceLog]
@LogDate datetime
AS
SELECT UserId, LogDate from DeviceLogs
where LogDate = @LogDate
return
--------------------------------------------------------------