INSERT DATE INTO SQLSERVER

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
HI


I tried to add new rows to the database SQL 2014 with the following stored procedure
A problem happened to me while saving the date field

ERROR

1615408.png


Time tool DateTimePicker that causes an error The error occurs if the date is like this for today's date


1615405.png

But if the date is before the 13th, no errors will occur

1615407.png

Note, some users have a date and time in Arabic and others have a time and date language in English. I want a way to match both languages.

Dim com As New SqlCommand()
com.CommandType = CommandType.StoredProcedure
com.CommandText = "ADDCLIENT"

com.Parameters.AddWithValue("@CLIENT_ID", SqlDbType.Int).Value = CLIENTUPDATE.LAB_IDVAL.Text
com.Parameters.AddWithValue("@CLIENT_CODE", SqlDbType.NVarChar).Value = CLIENTUPDATE.LAB_CODEVAL.Text
com.Parameters.AddWithValue("@CLIENT_DATE", SqlDbType.Date).Value = CLIENTUPDATE.DATATIM_DATERECOR.Value.ToShortDateString
com.Parameters.AddWithValue("@CLIENT_ACTIVE", SqlDbType.Bit).Value = True
com.Connection = con
con.Open()
com.ExecuteNonQuery()
con.Close()

Continue reading...
 
Back
Top