troubleshooting Question

Add DB record in ASPX.NET

Avatar of CaringIT
CaringITFlag for United Kingdom of Great Britain and Northern Ireland asked on
ASP.NETVisual Basic.NET
20 Comments1 Solution298 ViewsLast Modified:
Hi guys - this is a script to upload a file to our server for a helpdesk system, but I need it to now add a DB records with the following fields in the table uploadtable

callref - called ID1 in this code from the previous page

I also then need it automatically encrement fileid by one for each file it adds.

I can kind of do this in ASP, but not yet familiar with ASPX to do this here.

Any help gratefully received.

<script runat="server">
	Dim ID As String
	Dim DirectoryPath As String
	Dim FilePath As String
    Protected Sub Button1_Click(ByVal sender As Object, _
      ByVal e As System.EventArgs)
        If FileUpload1.HasFile Then
				ID = request.QueryString("ID1") 
				DirectoryPath = "C:\inetpub\wwwroot\Gremlinv4\mainsystem\UploadedFiles\" & ID
				FilePath = DirectoryPath & "\" & FileUpload1.FileName

                Label1.Text = "File name: " & _
                   FileUpload1.PostedFile.FileName & "<br>" & _
                   "File Size: " & _
                   FileUpload1.PostedFile.ContentLength & " kb<br>" & _
                   "Content type: " & _
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
            Label1.Text = "You have not specified a file."
        End If
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 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 20 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