Click here to Skip to main content
15,929,841 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRe: having problem in retrieving primary key from parent table Pin
$h@ma!|@5-Jul-07 19:06
$h@ma!|@5-Jul-07 19:06 
QuestionReports in asp.net 2005 Pin
zareee5-Jul-07 2:13
zareee5-Jul-07 2:13 
AnswerRe: Reports in asp.net 2005 Pin
Elizma5-Jul-07 18:53
Elizma5-Jul-07 18:53 
QuestionAccess and ASP.Net Pin
| Muhammad Waqas Butt |5-Jul-07 2:10
professional| Muhammad Waqas Butt |5-Jul-07 2:10 
AnswerRe: Access and ASP.Net Pin
Sathesh Sakthivel5-Jul-07 2:20
Sathesh Sakthivel5-Jul-07 2:20 
GeneralRe: Access and ASP.Net Pin
| Muhammad Waqas Butt |5-Jul-07 2:25
professional| Muhammad Waqas Butt |5-Jul-07 2:25 
GeneralRe: Access and ASP.Net Pin
Cfer835-Jul-07 8:33
Cfer835-Jul-07 8:33 
QuestionUnable to delete the file saved on the server. Pin
MissionSuccess5-Jul-07 2:01
MissionSuccess5-Jul-07 2:01 
Respected Gurus
I m using following code to import data from an excel file..
It works fine except one problem that

whenever i m trying to delete the file which i have saved on the server by using

file.delete(strfilename)

i left with the error "you do not have permission"
I think i have not closed the excel file.
how can i close it programmatically so that i can delete it also.

Dim strfilename As String
' Check the first open file dialog for a value
If Not (Me.File1.PostedFile Is Nothing) Then
' Get a reference to PostedFile object
Dim attFile As HttpPostedFile = File1.PostedFile
' Get size of the file
Dim attachFileLength As Integer = attFile.ContentLength
'Make sure the size of the file is > 0
If attachFileLength > 0 Then
' Get the file name
strfilename = Path.GetFileName(File1.PostedFile.FileName)
'Preceed the file name with "attachments/" so
'the file is saved to our Project's attachments Folder
strfilename = "Uploads/" + strfilename
'Save the file on the server
File1.PostedFile.SaveAs(Server.MapPath(strfilename))
End If
End If

Dim strConnectionString As String = String.Empty
'----------------------------------------------------------
'strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Driver=Microsoft Text Driver (*.txt;*.csv);Data Source=" + Server.MapPath(strfilename) + ";Extensions=asc,csv,tab,txt;Persist Security Info=False"
'----------------------------------------------------------

strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(strfilename) + ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
Dim cnCSV As New OleDbConnection(strConnectionString)
cnCSV.Open()

Dim cmdSelect As New OleDbCommand("SELECT * FROM [sheet1$]", cnCSV)

cmdSelect.CommandType = CommandType.Text
Dim daCSV As New OleDbDataAdapter
daCSV.SelectCommand = cmdSelect
Dim ds As New DataSet
daCSV.Fill(ds)

after using the dataset.
at last i am trying to delete the file.
which give me the error.

Please Help.
AnswerRe: Unable to delete the file saved on the server. Pin
InsDev5-Jul-07 2:11
InsDev5-Jul-07 2:11 
AnswerRe: Unable to delete the file saved on the server. Pin
kubben5-Jul-07 2:18
kubben5-Jul-07 2:18 
GeneralRe: Unable to delete the file saved on the server. Pin
MissionSuccess5-Jul-07 2:47
MissionSuccess5-Jul-07 2:47 
QuestionTwo way comunication...! Pin
PavanPareta5-Jul-07 1:54
PavanPareta5-Jul-07 1:54 
AnswerRe: Two way comunication...! Pin
Sonia Gupta5-Jul-07 1:58
Sonia Gupta5-Jul-07 1:58 
GeneralRe: Two way comunication...! Pin
PavanPareta5-Jul-07 18:52
PavanPareta5-Jul-07 18:52 
Questionhow to give file path run time Pin
kuwl_mark5-Jul-07 1:52
kuwl_mark5-Jul-07 1:52 
AnswerRe: how to give file path run time Pin
Tarik Guney5-Jul-07 1:59
Tarik Guney5-Jul-07 1:59 
Questioncopy file Pin
kuwl_mark5-Jul-07 1:48
kuwl_mark5-Jul-07 1:48 
AnswerRe: copy file [modified] Pin
Tarik Guney5-Jul-07 2:01
Tarik Guney5-Jul-07 2:01 
GeneralRe: copy file Pin
kuwl_mark5-Jul-07 4:22
kuwl_mark5-Jul-07 4:22 
Questionget and set in asp.net Pin
Sonia Gupta5-Jul-07 1:47
Sonia Gupta5-Jul-07 1:47 
AnswerRe: get and set in asp.net Pin
InsDev5-Jul-07 2:02
InsDev5-Jul-07 2:02 
AnswerRe: get and set in asp.net Pin
Tarik Guney5-Jul-07 2:04
Tarik Guney5-Jul-07 2:04 
GeneralRe: get and set in asp.net Pin
Sonia Gupta5-Jul-07 2:09
Sonia Gupta5-Jul-07 2:09 
AnswerRe: get and set in asp.net Pin
Christian Graus5-Jul-07 2:40
protectorChristian Graus5-Jul-07 2:40 
Questionerror while generate gridview programmatically Pin
findtango5-Jul-07 1:44
findtango5-Jul-07 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.