|
Well, I can tell your SQL statement is wrong. Your code says something like this:
SELECT * FROM C:\folder\somefile.mdf
which will not work at all. You're trying to try a file path as a table in SQL. You have to provide a TABLE name in the database to the SQL statement, not a file path.
Seriously, you're missing the very basic concepts of working with databases. I highly suggest picking up a book on VB.NET and ADO.NET and working through them.
|
|
|
|
|
I have an app that needs to delete a file or move it from an external drive
My app works fine in XP but fails in Vista because permissions are not set
I have tracked down the following but some properties are not correct for vb,net 2005 with net framework 2.0
## copied source details:
For those interested I have found a way to allow the permissions I set to be inherited for the folder/directory in question and all subfolders and files.
Apparently you must add a rule for each condition folder, folder objects and the container
Below is the additions:
Public Sub AddSecurityAttribute()
Dim directoryInfo As New DirectoryInfo(Me.FolderName)
Dim directorySecurity As AccessControl.DirectorySecurity = directoryInfo.GetAccessControl
' Add Security to This Folder, Subfolders and Files
' Must include an access rule for each condition
directorySecurity.AddAccessRule(New AccessControl.FileSystemAccessRule(Me.UserAccount, Me.FileRights, AccessControl.InheritanceFlags.ObjectInherit, AccessControl.PropagationFlags.InheritOnly, Me.ControlType))
directorySecurity.AddAccessRule(New AccessControl.FileSystemAccessRule(Me.UserAccount, Me.FileRights, AccessControl.InheritanceFlags.ContainerInherit, AccessControl.PropagationFlags.InheritOnly, Me.ControlType))
directorySecurity.AddAccessRule(New AccessControl.FileSystemAccessRule(Me.UserAccount, Me.FileRights, Me.ControlType))
directoryInfo.SetAccessControl(directorySecurity)
End Sub
Remember this is VB.NET 2.0 code, the AccessControl Class is new to the 2.0 framework.
any help much appreciated
|
|
|
|
|
Run your Application as Administrtor. For Running application as admin you should need of Menifest.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
Thanks for replying,
However, I am designing the app for other users who may or may not be administrator
With myself running this app as administrator I am also having the poroblem, so I need code to set permissions for the drive\folder to allow delete & move of files from an external drive
|
|
|
|
|
If you are login with administrator then it will running properly else it will required password of administrator.
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
Ihave run the application as administrator & I am getting this error message as shown in my question
It is my understanding that for Vista permissions are required in the program code to allow delete or move of files from an external drive
|
|
|
|
|
What error message is shown by Program.
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
this is the error message
full error text:
************** Exception Text **************
System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.__Error.WinIOError()
at System.IO.File.Move(String sourceFileName, String destFileName)
at Test_Ainfo.frmMain.btnMove_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
now, The problem is because I want to delete or move a file from an external drive, ie f or g, or h
I want somebody to tell me one of the following:
1. this is the code you need to add permissions to the drive\folder to do this
2. this is the code you need to get administrator permission
3. this is the code to both the above
4. it can't be done
surely I am not the only one with this problem, but where is the answer?
|
|
|
|
|
Right Click on Your Application.exe then Run it as Administrator.then check it.
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
It seems as though I can't get any answers to this problem
I have also logged it on 2 other forums with same result
So at the present time I will close this post in this forum
Thanks for your contribution
|
|
|
|
|
Hey guys if anyone could help me this would be extremely appreciated. My homework assignment is to take a checking account program that we've already written and add function procedures to it. The exact instructions are: Write function procedures for processing deposits, checks, and service charges. Deposit function adds the deposit to the balance; the check subtracts the transaction amount from the balance; the service charge function subtracts the amount from the balance. each of the functions must return the updated balance.
Again, this program currently works as it is right now but we have to tweak the code to include function procedures as per the above mentioned directions.
<pre>
Private Sub CalculateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateToolStripMenuItem.Click
Try
If Decimal.Parse(AmountTextBox.Text) > 0 Then
'assigns the variable
amountDecimal = Decimal.Parse(AmountTextBox.Text)
'checks to see which Radio button is checked and performs calculations
If DepositRadioButton.Checked Then
newbalanceDecimal += amountDecimal
totalamountdepositsDecimal += amountDecimal
totaldepositsInteger += 1
ElseIf CheckRadioButton.Checked Then
'checks to see if balance is greater than the amount entered
If newbalanceDecimal >= amountDecimal Then
newbalanceDecimal -= amountDecimal
totalchecksInteger += 1
totalamountchecksDecimal += amountDecimal
'If amount entered is more than the balance then give an error and deduct 10 bux from balance
Else
MessageBox.Show("Insufficient Funds")
newbalanceDecimal -= 10
totalamountchecksDecimal += 10
totalservicechargesInteger += 1
End If
ElseIf ServiceChargeRadioButton.Checked Then
newbalanceDecimal -= amountDecimal
totalamountservicechargesDecimal += amountDecimal
totalservicechargesInteger += 1
'If no radio button is selected then give an error
Else
MessageBox.Show("You must select either Deposit, Checking, or Service Charge" _
, "Selection Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
'displays the final total in textbox
NewBalanceTextBox.Text = newbalanceDecimal.ToString("C")
'enable the summary menu
SummaryToolStripMenuItem.Enabled = True
'if numeric values are not entered then give an error
Else
MessageBox.Show("You CANNOT enter negative numbers into the Amount of Transaction textbox" _
, "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch
MessageBox.Show("You must enter numbers into the Amount textbox", "Invalid Input" _
, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
|
|
|
|
|
So what's the problem?? No, we're not going to write your code for you. You wouldn't learn anything if we did that.
|
|
|
|
|
That's where your completely wrong. if someone would write one of the functions for me I would see how it's done and be able to do it again on my own. If you dont know the answer dont bother posting.
|
|
|
|
|
Boblc123 wrote: able to do it again on my own
Until your next homework assignment. We are here to help not do it for you.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
At least he admitted it was homework!
------------------------------------
"I am always serious about what I do, not necessarily about how I do it."
Tom Baker
|
|
|
|
|
Dalek Dave wrote: he admitted it was homework
Probably the only thing saving him from a flame-fest
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Boblc123 wrote: if someone would write one of the functions for me I would see how it's done and be able to do it again on my own.
You stated in your original assignment that you needed to write three functions. I take it that you'll model the other two yourself, once you got an idea of what is expected?
I are troll
|
|
|
|
|
Oh, I know the answer all right. Do you really think we all haven't had the same homework assignment??
I could write it up in about 15 minutes, but you'd still fail. The problem is coding style. Everyone writes code a bit differently, and mine would make the rest of your code VERY different. I'd also probably be using stuff that you haven't covered in class yet.
This is where you make the initial attempt at it, get stuck, then start asking questions.
|
|
|
|
|
You are an idiot. But just wanted everyone to know that I got help on another forum. So you can all go f*** yourselves. You stupid geeky no good son of a bitches who like to talk sh*t in forums because you know if you did it in real life you'd get your f***in face smashed in.
|
|
|
|
|
Boblc123 wrote: who like to talk sh*t in forums
I wasn't "talkin' sh*t". I was just mearly pointing out the truth.
Have fun failing your class...
...Oh! I hope you don't tell a prospective employer what your name is. These forum posts tend to show up in Google and Yahoo searches pretty fast, and, you know, the Internet never forgets, right?
|
|
|
|
|
That's got to be a record - 3 post and you have managed to piss off one of the most helpful people in the VB forum, you have proved that you are a foul mouthed fool too immature to take advice and too lazy to do your homework.
Bye - I don't expect we will see much of you here in the future.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Communication over the World Wide Web is unique. You have time to read and re-read the conversation as many times as you want. You can put together a reply, and revise it until it is just right. You can bring together hundreds of sources, and check the phrasing until it reads well. Presumably, you know this, and do this to every post where you want to make a well-thought out point. Now, after going through all of this, what justifies sending verbal abuse to another member, who has proved that he knows the answer by the simple fact that has already used it in many other replies to many other people? If this is the way you react to refusals, then that other forum is welcome to you
The general policy on this site is tough love; if you cannot refactor code yourself, then you need to learn how before moving on to a more advanced lesson. It's like a brain surgeon not knowing how to open the skull, but moving on to rewiring neurons. Would you want him/her working on your brain? It's a similar case when it comes to code
|
|
|
|
|
Hello every one,
Is there any way that we can convert or use a vb.net application as web application.
I did a some research and got more confused. Can some one plz guide in for the same
Regards
|
|
|
|
|
VB.NET is the language the app is written in. It is not the application type. No, you cannot convert a Windows Forms app into a Web App without rewriting at least the user interface layer BY HAND.
|
|
|
|
|
Thanks for the input.
Can you plz provide me any details
|
|
|
|