I have issue in date format. I have selected from date and to date.
Date is 2021-04-01 to 2021-04-15. But Json shows 1/4/2021. insert data from Json to Mssql table, it pickup date 4 and month from Jan to Dec.
Not showing April only
Below is my code
Public Class data_biz_trak
Public Property docno As String
Public Property docdate As String
Public Property custcode As String
Public Property custname As String
Public Property MarketingExe As String
Public Property Transporter As String
Public Property cnno As String
Public Property SoNo As String
Public Property invNo As String
Public Property amount As Decimal
End Class
Private Sub InsertData_BizTrak_Range()
Dim url As String = "http://localhost:57919/testurl/WebService.asmx/GetBizTrak_Data_Range?strfrom=2021-04-01&strto=2021-04-15"
ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType)
Dim json As String = (New WebClient).DownloadString(url.TrimEnd())
Dim res As List(Of data_biz_trak) = JsonConvert.DeserializeObject(Of List(Of data_biz_trak))(json)
For Each data_biz_trak In res
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "usp_API_BizTrak"
cmd.Parameters.Add(New SqlParameter("@Action", "INSERT-BIZTRAK-DATA"))
cmd.Parameters.AddWithValue("@docno", data_biz_trak.docno)
cmd.Parameters.AddWithValue("@docdate", data_biz_trak.docdate)
cmd.Parameters.AddWithValue("@custcode", data_biz_trak.custcode)
cmd.Parameters.AddWithValue("@custname", data_biz_trak.custname)
cmd.Parameters.AddWithValue("@MarketingExe", data_biz_trak.MarketingExe)
cmd.Parameters.AddWithValue("@Transporter", data_biz_trak.Transporter)
cmd.Parameters.AddWithValue("@cnno", data_biz_trak.cnno)
cmd.Parameters.AddWithValue("@SoNo", data_biz_trak.SoNo)
cmd.Parameters.AddWithValue("@invNo", data_biz_trak.invNo)
cmd.Parameters.AddWithValue("@amount", data_biz_trak.amount)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
cmd.Parameters.Clear()
cmd.Dispose()
Next
End Sub
selected date from 2021-04-01 to 2021-04-15 Json Format
[{"docno":"275","docdate":"2/4/2021","custcode":"63","custname":"Ut Consulting","MarketingExe":"Lester","Transporter":"Conubia LLC","cnno":"7725","SoNo":"5136","invNo":"4660","amount":15136.00},
{"docno":"330","docdate":"2/4/2021","custcode":"11","custname":"Proin Ltd","MarketingExe":"Kyla","Transporter":"Mauris Institute","cnno":"5836","SoNo":"5145","invNo":"4747","amount":16575.00},
{"docno":"669","docdate":"3/4/2021","custcode":"38","custname":"Neque Sed Eget Corp.","MarketingExe":"Boris","Transporter":"Dictum Proin Eget Foundation","cnno":"8122","SoNo":"5463","invNo":"4759","amount":15607.00},
{"docno":"225","docdate":"3/4/2021","custcode":"76","custname":"Aliquam Associates","MarketingExe":"Keelie","Transporter":"Dictum Ultricies Ligula Inc.","cnno":"6805","SoNo":"5372","invNo":"4692","amount":10268.00},
{"docno":"337","docdate":"10/4/2021","custcode":"64","custname":"Ipsum Leo Elementum LLP","MarketingExe":"Natalie","Transporter":"Consectetuer Institute","cnno":"3244","SoNo":"5056","invNo":"4985","amount":32854.00},
{"docno":"270","docdate":"10/4/2021","custcode":"100","custname":"Luctus Ipsum Leo Ltd","MarketingExe":"Calvin","Transporter":"Sed Inc.","cnno":"9991","SoNo":"5337","invNo":"4545","amount":33128.00},
{"docno":"718","docdate":"11/4/2021","custcode":"32","custname":"At Institute","MarketingExe":"Brenden","Transporter":"Lectus Corp.","cnno":"9636","SoNo":"6283","invNo":"4644","amount":29917.00},
{"docno":"401","docdate":"12/4/2021","custcode":"49","custname":"Faucibus Morbi Industries","MarketingExe":"Yvette","Transporter":"Non Corporation","cnno":"5584","SoNo":"6258","invNo":"4890","amount":27515.00},
{"docno":"437","docdate":"12/4/2021","custcode":"90","custname":"Malesuada Fames Industries","MarketingExe":"Wylie","Transporter":"Morbi Consulting","cnno":"7751","SoNo":"5627","invNo":"4707","amount":30748.00},
{"docno":"224","docdate":"13/4/2021","custcode":"53","custname":"Id Ante Dictum Institute","MarketingExe":"Nomlanga","Transporter":"Quam Limited","cnno":"3115","SoNo":"5445","invNo":"4990","amount":34503.00},
{"docno":"498","docdate":"13/4/2021","custcode":"13","custname":"Ullamcorper Viverra Maecenas Institute","MarketingExe":"Robert","Transporter":"Nunc Ullamcorper Corp.","cnno":"3475","SoNo":"6294","invNo":"4541","amount":33408.00},
{"docno":"528","docdate":"14/4/2021","custcode":"60","custname":"Leo In Lobortis Ltd","MarketingExe":"Simone","Transporter":"Duis Volutpat LLP","cnno":"5182","SoNo":"5150","invNo":"4991","amount":30648.00},
{"docno":"210","docdate":"14/4/2021","custcode":"51","custname":"Tempus Lorem Fringilla LLC","MarketingExe":"Tanek","Transporter":"Ante Ipsum Consulting","cnno":"7779","SoNo":"5100","invNo":"4625","amount":30068.00},
{"docno":"223","docdate":"15/4/2021","custcode":"42","custname":"Ornare Lectus Justo PC","MarketingExe":"Tyler","Transporter":"Bibendum Corporation","cnno":"6442","SoNo":"5014","invNo":"4788","amount":30851.00}]
Please advice me
Thank you in advance
Maideen