|
Have you tried the connectionstrings.com
We use the foxpro OLEDB driver to get at some esoteric DBF files.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
You Can Use foxpro OLEDB driver to get DBF Data.
|
|
|
|
|
Hello,
I am trying to download not one, but all files within a remote directory using FTP and C# and then save them to a local folder on my hard drive. How can I do this?
|
|
|
|
|
First one find the list of files from FTP Server path then Use FtpWebrequest WITH Downloadfile method
Dim clsRequest As System.Net.FtpWebRequest = DirectCast(System.Net.FtpWebRequest.Create(ftppath), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential(FTP_USERNAME, FTP_PASSWORD)
clsRequest.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
If you can think then I Can.
|
|
|
|
|
See this example:
[^]
Get the file list from the directory, which you want to download, then download each file in that directory.
|
|
|
|
|
hello sir ,
my problem is that my datagrid have 3 datagridtextbox columns
value1 value2 total
now i want to calculate total while entering data in value or value1
while using userdefine event finally realized that it works on a plain TextBox and not
within a TextBox with a DataGrid.
thank u.
|
|
|
|
|
Take a look at this[^], particularly the third answer down.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thanks for ur response
actually i am using datagrid control my problem is not to sum data
but to calculate it in other cell while editing
|
|
|
|
|
There is a very correct option in doing this.
first create a class having three private float variable amount1, amount2, total.
Now create getter setters of all of them. the class should look like this.
public class Temp
{
//private members
private float num1 = 0;
private float num2 = 0;
private float total;
//Public members
public float Num1
{
get; set;
}
public float Num2
{
get; set;
}
public float Total
{
get
{
return Num1 * Num2;
}
//Dont keep setter as Total should be read only.
}
}
Now in your form.cs file just bind the list of this class to the datagrid you want
List<temp> temps = new List<temp>();
datagridview1.DataSource = temps;
Compile it...
Whenever you change the value of Num1 and Num2, Total will automatically get changed.
|
|
|
|
|
I am working with csv files.
I started out using ADO to grab column and data, however there is a flaw in doing this.
I have data that is F3, F5, F{something} and Excel automatically tries to put the dataType as a Float.
I moved to opening the file using StreamReader and im able to successfully import an excel file into my application - but now I don't have the columns DataType.
Another bad thing about ADO I can't have is the 255 column limit, we will have datasets that contain over 300 columns if not more.
So what I ended up doing (just an fyi), is first collecting the List<string> of columns by using StreamReader reading the first line (headers) and placing them inside a List<string>
Now I iterate through the List<string> and use ADO to pull back that column name but empty -
(Select {columnName} from {XlsFile} Where 1=2)
I get back the column data and add it into a Dictionary<string,string> {'column', 'datatype'}
I now have my column Data that I need.
Now I have to go back through the csv file again using StreamReader
This time I am creating a DataTable with the columns and data inside it
Before I add the column I set the datatype to whatever the dataType is in the Dictionary<string,string> for that column Name.
Ok, this works good until I get data inside a column like 'F3'.
I know that Excel reads like 8-10 rows and tries to 'guess' what the dataType would be.
(any work arounds for this?)
Excel has already set this datatype to a 'float' or 'decimal' when it should of been 'string'
Ok, now my question(s)
1. Does this make sense?
2. Am I going to have to iterate through the data and if column's dataType is anything but String try to convert the data to the columns dataType and see if it's a match?
3. Any idea's on how I can get the correct dataTypes and columns without Interop or ADO?
Hope this makes sense, if not express it and I'll clarify.
Steve Welborn
Software Engineer
Eli Lilly
Indianapolis, Indiana.
|
|
|
|
|
Swelborn wrote: Need suggestion on getting column data from excel without using ADO or Excel Interops
Since you're shot down the two programmatic methods of doing this, you're left with starting Excel and typing everything in yourself.
Swelborn wrote: Another bad thing about ADO I can't have is the 255 column limit,
That limit is also imposed by most versions of Excel, not just ADO.
Swelborn wrote: Excel has already set this datatype to a 'float' or 'decimal' when it should of been 'string'
Then you need to use quotes around the value in your CSV to force a string type.
Swelborn wrote: 3. Any idea's on how I can get the correct dataTypes and columns without Interop or ADO?
You don't have any other options. Those are the two programmatic methods you have of talking to Excel.
Well, that is unless you're using Excel 2007 which doesn't have the 255 column limit and now uses a completely different file format allowing you much greater control over creating a workbook, since it's based mostly on an XML format.
Why does it appear that you're using Excel as a database, something that it is very poor at doing??
|
|
|
|
|
Thanks Dave for the response.
Dave Kreskowiak wrote: Since you're shot down the two programmatic methods of doing this, you're left with starting Excel and typing everything in yourself.
Ok well that answered the bulk of my questions - have you ever ran up against the Data of a column being F3, F2 and such and Office thinking its a float and setting its datatype of the column to Decimal (int32 would of been fine..but not decimal)?
Dave Kreskowiak wrote: That limit is also imposed by most versions of Excel, not just ADO.
Right, actually going back and reading my post you could actually replace ADO with Excel.
Dave Kreskowiak wrote: Then you need to use quotes around the value in your CSV to force a string type.
I agree this would be a solution, however, the application we are developing is for pivoting of data on a pivotGrid doing aggregates and we cannot assume string if we need it to be an integer.
Dave Kreskowiak wrote: You don't have any other options. Those are the two programmatic methods you have of talking to Excel.
Well, that is unless you're using Excel 2007 which doesn't have the 255 column limit and now uses a completely different file format allowing you much greater control over creating a workbook, since it's based mostly on an XML format.
Yea I knew that but client's won't upgrade to 07 till later. I'm stuck with 03.
Dave Kreskowiak wrote:
Why does it appear that you're using Excel as a database, something that it is very poor at doing??
Were not. Client drops a csv file onto the pivotGrid, we import that data into the pivotGrid and in doing so we needed to make sure that the columns are setup correctly (ie.minus the F3 float bug).
The first round I was grabbing the data using strictly ado..Stopped using ado because of the way it determines DataTypes on columns..then moved to a csv parser using StreamReader but then lost our dataTypes. So now im researching other alternatives but there doesn't seem to be any.
I do appreciate your response and time Dave. I understand I'm stuck with what I have now. I'll keep trying other idea's.
Enjoy your afternoon.
|
|
|
|
|
If all you've got is a CSV file and Excel is getting the data types wrong, you're going to have to parse it yourself and put each value into each cell. This be be a considerably slower process. You're only other option is to Interop with Excel, import the CSV and write code to clean up the data afterwards.
|
|
|
|
|
Rajdeep.NET (Thats me) wrote: Hi pals,
I am trying to create a small utility which can block folders from direct access. For this purpose, I have a textbox in my form and a two buttons namely: browse and apply.
Now, whenever the user clicks on browse, the Open file dialog box appears and whatever folder has been selected by the user is displayed in the textbox.
Now, comes the major problem. In order to block the particular folder selected by the user, I have to generate two batch files (files with .bat extension) on the location of the folder, that has to be locked. Like if the folder to be blocked is in this 'C:\\myfolder\\subfolder\\lockfolder' location, where lockfolder is the particular folder which I have to lock, then in that case, I have to generate a batch file in 'C:\\my folder\\subfolder\' that will lock the folder 'lockfolder'.
Any Idea how to do that..... please recommend.
Sorry for my poor english,
Cheers to you,
Rajdeep.NET
So many replies but all useless and hurtful...... I hope that you guys should had read the question properly before commenting. Some said, "Learn to google", while some said, "learn C#"!!! Someone even said that I was upto some malicious thing. What a DUMB thinking!!!! I wonder, how I could create a virus or any other malware stuff using .NET?! Wont the to be infected system require .NET framework to be installed already....before hand in order to make the .exe malware functioning? Or will my virus show "Invalid Win32 Application" || "The application failed to initialize properly"???!!!!
Why comment when you are not at all capable for sorting out my problem or suggesting a comprehensive way to solve it (I dont mean that you directly handover a code to me, because I know that you wont be paid for writing codes for me) All sort of British Mumbo Jumbo prevails here, it seems. And I remember, even somebody said that all my postings were flagged RED!
Now, let me directly come to the point. Whats so funny about my question?! Some said that I have to use the StreamWriter method and yes, I am familiar to that ofcourse. I ain't idiot. Actually my way of posting the question was incorrect. Thats it. I am not a Graduate in English as you all are and neither is my mother tongue english.
So here I am once again to explain my problem more comprehensively:
I know that I have to use the StreamWriter method and create a text file, where I'll enter the required execution parametres and then convert it to .bat using the File.Move() method. But thats not the problem at all actually.
I have to get the folder path using the DirectoryInfo[] method. But how will I generate a batch file (txt file renamed as .bat executable) in the location where the folder is saved?
Thats my question.....
Cheers,
Rajdeep.NET
|
|
|
|
|
path = directory + @"\something.bat";
StreamWriter sw = System.IO.File.CreateText(path);
|
|
|
|
|
Your question is idiotic and lacks common sense.
Rajdeep.NET wrote: I have to get the folder path using the DirectoryInfo[] method.
So you have the folder path.
Rajdeep.NET wrote: But how will I generate a batch file (txt file renamed as .bat executable) in the location where the folder is saved?
You have the folder path and the new name of the file you are creating. And you're still asking how to save it in the folder!
Hang on a second while I search for something on Google[^].... WOW! What a surprise! The first link tells me exactly how to do it!
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
|
First, if you can't figure out how to write to a text file in the folder path THAT YOU ALREADY HAVE, then you really do need to pick up a beginners book on C# and work through it. This is not meant to be hurtful in any sense of the word. It really does show your lack of knowledge on how to do something so trivial and that you really do need to learn the basics.
On top of that, I can't think of a single, good, supportable solution to block and unblock folders using batch files and because of that, I have to question your knowledge of Windows Security and NTFS.
|
|
|
|
|
Dave Kreskowiak wrote: On top of that, I can't think of a single, good, supportable solution to block and unblock folders using batch files and because of that, I have to question your knowledge of Windows Security and NTFS.
Hi Dave,
Ofcourse theres a brilliant and supported solution to block folders using batch files!!!
Here's how:
There are plenty of software which lock your folders, some are free, other costs a lot of money. Why you’ll waste time and money when you could do it with your notepad.
* Consider you want to lock a folder named PICS in your D:\, whose path is D:\PICS
* Now open the Notepad and type the following
ren pics pics.{21EC2020-3AEA-1069-A2DD-08002B30309D}
* Where pics is your folder name. Save the text file as loc.bat in the same drive.
* Open another new notepad text file and type the following
ren pics.{21EC2020-3AEA-1069-A2DD-08002B30309D} pics
* Save the text file as key.bat in the same drive.
Usage:
* To lock the pics folder, simply click the loc.bat and it will transform into control panel icon which is inaccessible.
* To unlock the folder click the key.bat file. Thus the folder will be unlocked and the contents are accessible.
That’s all.
Is that clear o you now!
Cheers,
Rajdeep.NET
|
|
|
|
|
That's an old and very defeatable trick. Plus, if you setup your NTFS security permissions correctly, you don't have to do this at all and it can't be defeated!
|
|
|
|
|
You still haven't explained your projects general purpose. Many of your threads constitute potential malware or other type of malicious bits and pieces, and people put pieces of a puzzle together.
Furthermore, you've shown no effort to learn the language or at least the basics before you begin posting, most of the stuff you ask is covered in the MSDN documentation as extremely basic tasks, so it's apparent you haven't began searching the most common place for answers, nevermind extensive (or some would consider basic) searching of crawling through google.
I still ask, what is the general purpose of your application, what does it do and why is it doing it? Why are you hiding console applications, copying applications and locking folders. What is the purpose?
|
|
|
|
|
Hi Eliotta,
For your kind information, I am upto no malicious stuff. Rather, I am focusing all my attention towards the security angle, imlementing .NET. I need to block folders for security purposes and not for heuristic ones. If it would had been for me, then I would have never consulted you guys, since I am doing it by using a simple batch trick which I already posted as a reply to Dave Kreskowiak....
But this is for users, not just for me or you. Yeah I agree that replicating files and hiding console applications sounds malicious but I am just trying to test my software. Its almost done but, the only problem I am facing is in the question.
I need to hide my console application, because it will take a lot of time to process and so I only wanted to avoid the console window for the users. Thats all....
Otherwise, I am not going for anything like the dotnut or the sharpie virus because I am just 16 now. And I am trying to focus entirely on development else huer.
Cheers,
Rajdeep.NET
|
|
|
|
|
Rajdeep.NET wrote: I need to hide my console application, because it will take a lot of time to process and so I only wanted to avoid the console window for the users. Thats all....
Change the project properties for the exe to a Windows application. Then it won't show a console, and since your application doesn't show any windows (I hope) then it will just run in the background.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Please, go away. Don't continue. I'm tired of your posts beyond belief. I don't believe you, I don't think anyone is.
|
|
|
|
|