|
The guy you 1 voted had it right. If you were to use google, you'd get heaps of info on this. Seeing as you're too lazy, I did it for you. Here's the answer I found.
"that usually indicates that the default sort order in Pdox and Access are different, and the Pdox table you're trying to touch is keyed (indexed)"
Imagine how much work you could achieve if you were willing to search for yourself ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hey Dude,
Declare the oledb Connection Object Like This.
OleDbConnection cn=new OleDbConnection(ConfigurationManager.ConnectionStrings["connstring_card"].ConnectionString;
may be it will helpful to you...
|
|
|
|
|
1) He's clearly not defined his conn string in the ConnectionStrings element in his web config - he's defined it in appSettings
2) Your code snippet would not compile, it's missing a closing parenthesis.
|
|
|
|
|
Hi,
I am using MasterPages in my project. It is working fine.
In some child pages MasterPage content(Images, MenuControl) is not visible. ChildPage Content() is overriding the masterPage content.........How to Avoid?
How to move the Content)control in child page?
Note: Most of the pages it is looking good but int two or three pages it is happening...
Thanking you
McMilan.
|
|
|
|
|
Hi there,
I'm having a pretty serious problem with file uploads not working on my live site. I was able to upload fine when I was testing in VS on my local machine.
When I try to upload a file I'm getting the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Could not find a part of the path 'C:\Users\Fred\Desktop\James\Organised Files\Images\cherries.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Fred\Desktop\James\Organised Files\Images\cherries.jpg'.
I'm using an aspnet fileupload control and my code is as following:
Dim photoFileUpload As FileUpload = CType(dvCrops.FindControl("photoFileUpload"), FileUpload)
If photoFileUpload.PostedFile Is Nothing Then
lblMessage.Text = "No file specified."
Exit Sub
Else
Dim FileName As String = photoFileUpload.PostedFile.FileName
All my following code requires FileName to be accurate. So i'm 100% sure my problem is on that last line.
I've tried using System.IO.Path.GetFullPath but that doesn't seem to be helping.
Any ideas would be really helpful.
Many Thanks
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
JimBob SquarePants wrote: Could not find a part of the path 'C:\Users\Fred\Desktop\James\Organised Files\Images\cherries.jpg'.
The path here refer to the client machine path. It doesn't matter. Where you are trying to upload? I meant the server's location at which the uploaded files are stored.
|
|
|
|
|
I'm actually uploading an image file directly onto a database. I can edit that database so I have appropriate access. It's just an image file from my local computer. I'm sure i've just missed out something to tell the server to look on the users computer.
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
R u storing only Image full path in database or complete file??????
Because if u r storing only path, then while u retrive server reads pathe as C://.......... and tries to find that file in server's C://, and file is obviously not their. .. so its giving FileNotFound Exception I guess....
Tell me what u r doing???
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
Definitely you are missing something. Post your uploading code. Will try to find out the problem.
|
|
|
|
|
Ok Firstly I'll give you all a quick runthrough of what I'm doing.
Essentially I'm Identifing the file, loading and resizing it in memory and producing a System.Data.Linq.Binary object that is uploaded to my database.
All this works when I'm running the website on my local machine. The live version can't find the file.
Here Goes:
'----------------------------------------------------------------------------------
' Name : btnAddPhoto_Click
' Purpose : This event handles the Conversion of the uploaded image files to System Data Linq Binary.
'----------------------------------------------------------------------------------
Protected Sub btnAddPhoto_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles btnAddPhoto.Click
Dim photoFileUpload As FileUpload = CType(dvCrops.FindControl("photoFileUpload"), FileUpload)
If photoFileUpload.PostedFile Is Nothing Then
lblMessage.Text = "No file specified."
Exit Sub
Else
Dim FileName As String = photoFileUpload.PostedFile.FileName
Dim ext As String = FileName.Substring(FileName.LastIndexOf("."))
ext = ext.ToLower
If ext = ".jpg" Then
ElseIf ext = ".bmp" Then
ElseIf ext = ".gif" Then
ElseIf ext = "jpg" Then
ElseIf ext = "bmp" Then
ElseIf ext = "gif" Then
Else
lblMessage.Text = "Only gif, bmp, or jpg format files supported."
Exit Sub
End If
' convert the fileupload.postedfile to system.data.linq.binary
Dim source As FileInfo = New FileInfo(FileName)
Dim buffer() As Byte = New Byte(photoFileUpload.PostedFile.ContentLength - 1) {}
source.OpenRead.Read(buffer, 0, photoFileUpload.PostedFile.ContentLength)
buffer = ResizeImageFile(buffer, 200)
crpImage1 = New System.Data.Linq.Binary(buffer)
lblMessage.Text = "Image Successfully Uploaded."
End If
End Sub
ResizeImageFile refers to this:
Public Shared Function ResizeImageFile(ByVal imageFile() As Byte, ByVal targetSize As Integer) As Byte()
Using oldImage As System.Drawing.Image = System.Drawing.Image.FromStream(New MemoryStream(imageFile))
Dim newSize As Size = CalculateDimensions(oldImage.Size, targetSize)
Using newImage As Bitmap = New Bitmap(newSize.Width, newSize.Height, PixelFormat.Format24bppRgb)
Using canvas As Graphics = Graphics.FromImage(newImage)
canvas.SmoothingMode = SmoothingMode.AntiAlias
canvas.InterpolationMode = InterpolationMode.HighQualityBicubic
canvas.PixelOffsetMode = PixelOffsetMode.HighQuality
canvas.DrawImage(oldImage, New Rectangle(New Point(0, 0), newSize))
Dim m As New MemoryStream
newImage.Save(m, ImageFormat.Jpeg)
Return m.GetBuffer
End Using
End Using
End Using
End Function
Calculate Dimensions to this:
Public Shared Function CalculateDimensions(ByVal oldSize As Size, ByVal targetSize As Integer) As Size
Dim newSize As Size
If (oldSize.Height > oldSize.Width) Then
newSize.Width = CType((oldSize.Width * CType((targetSize / CType(oldSize.Height, Single)), Single)), Integer)
newSize.Height = targetSize
Else
newSize.Width = targetSize
newSize.Height = CType((oldSize.Height * CType((targetSize / CType(oldSize.Width, Single)), Single)), Integer)
End If
Return newSize
End Function
Hope this clears everything up.
Thanks in advance!
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
JimBob SquarePants wrote: ' convert the fileupload.postedfile to system.data.linq.binary Dim source As FileInfo = New FileInfo(FileName) Dim buffer() As Byte = New Byte(photoFileUpload.PostedFile.ContentLength - 1) {}
This is very wrong way of getting the bytes of uploaded file. What you are trying is, you are getting the filename and trying to get the bytes of invalid file in the server.
Dim FileSize As Integer = 0
FileSize = fileUpload.PostedFile.ContentLength
Dim FileData(FileSize) As Byte
fileUpload.PostedFile.InputStream.Read(buffer, 0, FileSize)
Now you will get the bytes of the selected file.
modified on Wednesday, July 30, 2008 7:12 AM
|
|
|
|
|
My fingers were well and truly crossed then. Sadly no luck.
Dim source As FileInfo = New FileInfo(FileName )
I wasn't happy with that part of the code. I'm pretty much a beginner so I'm sure there are a few more bits in there that could do with an overhaul.
Could there be a problem with the way the stream is read from my computer from the server e.g should "\" be "/"??
Thanks so far!
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
As I told you before you are trying to get the bytes of a file from the user's machine in the server's location.
Rather, FileUpload control automatically provides the bytes using a simple function call like fileUpload1.PostedFile.InputStream.Read(arg1, arg2, arg3) (refer my previous post for the code).
|
|
|
|
|
Ok this is what I have done so far. It's still giving me the same error.
Thanks for staying with me so far.
Dim photoFileUpload As FileUpload = CType(dvCrops.FindControl("photoFileUpload"), FileUpload)
Dim myfile As HttpPostedFile = photoFileUpload.PostedFile
Dim FileSize As Integer = 0
FileSize = myfile.ContentLength
Dim FileData(FileSize) As Byte
myfile.InputStream.Read(FileData, 0, FileSize)
FileData = ResizeImageFile(FileData, 200)
crpImage1 = New System.Data.Linq.Binary(FileData)
What am i doing wrong?
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
That is it. Now it should be all set, I believe.
|
|
|
|
|
Thanks for your help.
I forgot to upload the new dll file for my site so the changes were not being implemented.
Thankyou again
JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************
|
|
|
|
|
JimBob SquarePants wrote: Any ideas would be really helpful.
When you are trying to save image on the server then this error causes.
I am sure your code looks like this
FileName.PostedFile.SaveAs(FileName.PostedFile.FileName)
You need to Map Server path and save file there.
Like this
FileName.PostedFile.SaveAs(Server.MapPath(Path.GetFileName(FileName.PostedFile.FileName)))
This line of code will save image on root folder
please don't forget to vote on the post that helped you.
|
|
|
|
|
That's what I was trying to tell him
1. Create one folder (suppose: image) in your portal,
2. save that file using Server.MapPath("\\image\\" + Path.GetFileName
(FileName.PostedFile.FileName))
3. Save that path ("\image\..filename.jpeg") into database
4. Now when u want to access that file, just retrive that path from
database (eg. str), and write image.URL = Server.MapPath(str).
5. That's all!!!!!!!!!!
right???
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
Hello All,
Suppose I am selling things on line and I am using pay pal to handle credit card transactions, how do I know if a transaction is successful? I'm planning to keep track of all items by creating an inventory program which subtracts the number of items sold from the total number of items in the inventory, only after the transaction is successful. That is my where my problem lies, I don't know how to determine if a transaction is successful. Any help, any suggestions on how to go about solving this will be greatly appreciated, thanks in advance for your time.
modified on Tuesday, July 29, 2008 10:20 PM
|
|
|
|
|
The paypal gateway should tell you it has successfully processed a transaction
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
It returns IPN,you have to read the IPN as it contains the value of whether the transaction is successful or not
|
|
|
|
|
Yeah, I've used real gateways, but not Paypal. I just knew that there had to be some way hidden in the documentation.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Does any one have experience in intergrating chameleon with Asp.net Application... If yes Plz help me
Santhapur
|
|
|
|
|
Hi,
Follwing error : -"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) "
Version what we are using is Asp.net2.0 + sqlserver2000
Thanks in advance
With regards
Senthilkumar.T
|
|
|
|
|
There could be several reasons why this is happening, a good point to start would be to type that error into google and you will find loads of error messages.
|
|
|
|