Sub Upload_Click(Sender As Object, e As EventArgs)
connec = new sqlconnection("server=ANT1-WUTBIS8994; database=Net_server; user id=sa; trusted_connection=false;")
dim mycommand As sqlcommand
dim cmd As String="insert into material(ramo,archivo,tipo )values(@opcion,@nombre,@extension)"
mycommand = new sqlcommand(cmd,connec)
mycommand.Parameters.Add(New SqlParameter("@opcion", SqlDbType.varChar,20 ))
mycommand.Parameters("@opcion").Value = opcion.SelectedItem.text
mycommand.Parameters.Add(New SqlParameter("@nombre", SqlDbType.nvarChar,50))
mycommand.Parameters("@nombre").Value = nombre.Text
mycommand.Parameters.Add(New SqlParameter("@extension", SqlDbType.nvarChar, 50))
mycommand.Parameters("@extension").Value = extension.Text
Dim postedFile = uploadedFile.PostedFile ' kabio a postedFile
If Not (postedFile Is Nothing) Then
connec.open() mycommand.ExecuteNonQuery()
connec.close()
Dim filename As String = Path.GetFileName(postedFile.filename)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength
postedFile.SaveAs(savePath & filename)
'envio datos de proceso a la etiketa mensaje
mensaje.Text = postedFile.Filename & " subiendo" & _
"<br>content type: " & contentType & _
"<br>content length: " & contentLength.ToString()
End If