I have a ASPX page I have been building in Visual Studio.
I have the page working to look up single part numbers
here it is
http://bakerabilene.com/in
Well, now i want users to be able to compare many numbers instead of one at a time.
I had this setup in my access database but now i need it to be web based so it works for all my companies.
Turns out that since my host is GoDaddy they do not allow excel files to be uploaded to sql server. I already have purchased a year and would like to get this done by staying with them.
What should I do? Is there another way of doing this?
Could i do this via csv file? I found that GoDaddy allows csv imports but i cant seem to figure it out.
I had originally planned on users clicking a browse button to select the file, then upload to transfer data to sql server. Once there it would run a query to fill the appropriate data, export back to excel and users could view file.
Is there another way of doing this that im missing?
Or is my best option to switch web host?
Protected Sub cmdImport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdImport.Click
Dim savedFiles As String
If Me.FileUpload1.PostedFile Is Nothing Then
MessageBox("this file not correct")
Else
Dim strExt As String = Path.GetExtension(Me.FileUpload1.PostedFile.FileName)
If strExt.ToLower() = ".csv" Then
savedFiles = Path.GetFileName(Date.Now.Day & Date.Now.Month & Date.Now.Year & Date.Now.Hour & Date.Now.Minute & Date.Now.Second & ".csv")
Me.FileUpload1.PostedFile.SaveAs(Server.MapPath("temp\") & savedFiles)
MessageBox("upload successful ")
Dim Excel As String = Server.MapPath("temp\" & savedFiles)
Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Excel & ";" & "Extended Properties=Text;FMT=Delimited;")
ExcelConnection.Open()
Dim expr As String = "SELECT * FROM [Sheet1$]"
Dim objCmdSelect As OleDbCommand = New OleDbCommand(expr, ExcelConnection)
Dim objDR As OleDbDataReader
Dim SQLconn As New SqlConnection()
Dim ConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings("baminterchangerConnectionString").ConnectionString
SQLconn.ConnectionString = ConnString
SQLconn.Open()
Using bulkCopy As SqlBulkCopy = New SqlBulkCopy(SQLconn)
bulkCopy.DestinationTableName = "imports"
Try
objDR = objCmdSelect.ExecuteReader
bulkCopy.WriteToServer(objDR)
ExcelConnection.Close()
MessageBox("Sent to SQL")
'objDR.Close()
SQLconn.Close()
Catch ex As Exception
MessageBox(ex.ToString)
End Try
End Using
End If
End If
End SubI tried the above code to get the csv file to web server (which it does) but it will not get it to my sql table
Gives me this error