Dear all,
I am trying to export the date from datatable to excel. But i am not getting the records.
This is where i am passing the values:
Dim cons As String = My.Settings.DBRestroConnectionString
Dim rdate As String = Format(DateTimePicker1.Value, "dd-MM-yyyy")
st = "SELECT BillMaster_1.Date, BillMaster_1.BillNo, BillMaster_1.TableNo, BillMaster_1.WaiterNo, BillMaster_1.CoverNo, BillMaster_1.BillAmount, PayModeMaster.PayMode, (SELECT SUM(BillAmount) AS TotalAmount FROM BillMaster) AS 'Total' FROM BillMaster AS BillMaster_1 LEFT OUTER JOIN PayModeMaster ON BillMaster_1.PaidMode = PayModeMaster.PayModeId"
FN = "BillSummary"
moh = valq.excelexport(cons, st, FN, "BillMaster_1.Date", rdate)
function:
Dim Xlapp As New Microsoft.Office.Interop.Excel.Application
Dim TOTALcount As Integer
' Dim DT As Date
Dim sqlcon As New SqlConnection(constr)
Dim sqlcommd As New SqlCommand
sqlcommd.Connection = sqlcon
sqlcommd.CommandText = sqlstr + " where " + filter >= +"@x"
sqlcommd.Parameters.AddWithValue("@x", para)
'sqlcommd.Parameters.AddWithValue("Date", DT)
Dim sqlda As New SqlDataAdapter(sqlcommd)
Dim sqldt As New DataTable
sqlda.Fill(sqldt)
TOTALcount = sqldt.Rows.Count
If sqldt.Rows.Count > 0 Then
I am getting zero records everytime.
Regards,
Mohinder Singh