troubleshooting Question

ASP.NET Import VB Code

Avatar of Larry Brister
Larry BristerFlag for United States of America asked on
.NET ProgrammingMicrosoft DevelopmentEditors IDEs
4 Comments1 Solution335 ViewsLast Modified:
I have a script that is importing data from a csv file fine...with the exception of some (user) typos in a date column.

The column is supposed to be mm/dd/yyyy format.

I'm calling a SQL Server stored procedure do I strip / replace any invalid characters?  Or at the very least, give a message that points to the error row and what is invalid?

partial code is attached...
Dim row As DataRow
  For Each row In dt.Rows
   Dim checkin As String = ""
   checkin = row(0).ToString
 Dim objConn1 As SqlConnection = New SqlConnection System.Configuration.ConfigurationManager.AppSettings("strConnS"))
 Dim oCom1 As SqlCommand = New SqlCommand
 oCom1.Connection = objConn1
 oCom1.CommandText = "impdata"
 oCom1.CommandType = CommandType.StoredProcedure
 oCom1.Parameters.Add(New SqlParameter("@checkin", SqlDbType.DateTime)).Value = checkin
 lblMessage.Text = "Successfully Uploaded File: " & file.GetNameWithoutExtension() & file.GetExtension()
 specialType.SelectedValue = "0"
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros