spukemiszer
New member
- Joined
- Dec 4, 2008
- Messages
- 2
- Programming Experience
- Beginner
first time posting hope its in correct spot
so im making a program that uses excel as the database as im leanring and dont know how to use a database yet.
it reads the excel file from www.fakesite/test/file.xls
the file contains username/password/accounttype
i load the file with
i can add new users / passwords / types
but i want to resave it back to the ftp site
i have tried
how would i save the "xlwoorkbook" file using ftp replacing the original
id prefer not to have to save a copy to my computer then back to the site.
if you need more information please ask as i am unsure of what else to tell you
so im making a program that uses excel as the database as im leanring and dont know how to use a database yet.
it reads the excel file from www.fakesite/test/file.xls
the file contains username/password/accounttype
i load the file with
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("site")
xlWorkSheet = xlWorkBook.Worksheets("users")
i can add new users / passwords / types
but i want to resave it back to the ftp site
i have tried
with sub asDim credential As New NetworkCredential("username", "password")
Upload(users.xls, "ftp://site/Test/users.xls", credential)
Private Sub Upload(ByVal source As String, ByVal target As String, _
ByVal credential As NetworkCredential)
Dim request As FtpWebRequest = _
DirectCast(WebRequest.Create(target), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = credential
Dim reader As New FileStream(source, FileMode.Open)
Dim buffer(Convert.ToInt32(reader.Length - 1)) As Byte
reader.Read(buffer, 0, buffer.Length)
reader.Close()
request.ContentLength = buffer.Length
Dim stream As Stream = request.GetRequestStream
stream.Write(buffer, 0, buffer.Length)
stream.Close()
Dim response As FtpWebResponse = DirectCast(request.GetResponse, FtpWebResponse)
MessageBox.Show(response.StatusDescription, "File Uploaded")
response.Close()
End Sub
how would i save the "xlwoorkbook" file using ftp replacing the original
id prefer not to have to save a copy to my computer then back to the site.
if you need more information please ask as i am unsure of what else to tell you