Well, yes, it probably will.
Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
They make your code more readable, are more reliable, and they prevent me from destroying your database by typing into your application...
In addition, list the fields you are trying to insert into - again, it makes your code more reliable, and it's a lot safer.
Using con As New SqlConnection(strConnect)
con.Open()
Using com As New SqlCommand("INSERT INTO myTable (myColumn1, myColumn2) VALUES (@C1, @C2)", con)
com.Parameters.AddWithValue("@C1", myValueForColumn1)
com.Parameters.AddWithValue("@C2", myValueForColumn2)
com.ExecuteNonQuery()
End Using
End Using
Then, convert your dates to DateTime values using DateTime.TryParse and report any problems to the user before you even try inserting a record - that way you can give them a more accurate error which helps them get it right. You then pass the DateTime values directly to SQL so there is no more conversion to do and it all works.
It improves your code, gets rid of your problem and a number of future problems as well...
"Still I am not clear, what are you trying to say. Can you show me example in my code?"
I'm not going to sit here and convert all that hard-to-read code to proper code: I have no use for it, so I'm not going to spend my time on it.
But...The code above, if written in your code would be:
str = "Insert Into Employee_Detail values("& myValueForColumn1 & ",'" & myValueForColumn2 & "')"
So you should be able to work it out from that.