Try Dim cb As New OdbcCommandBuilder(da) Dim dsNewRow As DataRow dsNewRow = ds.Tables("Add").NewRow() dsNewRow.Item("id") = no dsNewRow.Item("vehicleNo") = txtlVin.Text dsNewRow.Item("challanNo") = txtlChno.Text dsNewRow.Item("itemName") = txtlItmNm.Text dsNewRow.Item("quantity") = txtlQty.Text dsNewRow.Item("CustName") = txtlCustNm.Text dsNewRow.Item("site") = txtlSite.Text dsNewRow.Item("indate") = System.DateTime.Now.ToString((" yyyy-MM-dd")) 'Date.Today dsNewRow.Item("intime") = TimeOfDay dsNewRow.Item("intype") = "LOAD" dsNewRow.Item("inout") = "IN" ds.Tables("Add").Rows.Add(dsNewRow) da.Update(ds, "Add") MsgBox("New Record added to the Database") Catch ex As Exception MsgBox(ex.ToString) Finally cn.Close() da.Dispose() ds.Dispose() End Try
System.DateTime.Now.ToString(("hh:mm:ss"))
dsNewRow.Item("intime") = System.DateTime.Now.ToString("HH:mm:ss tt") 'Gives it to you as a string.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)