unable to delete directory from SFTP server - c#

I am trying to delete the directory from my SFTP server. I am using EnterpriseDT.Net.Ftp SSHSCPClient for connecting to the server with private key, no password.
When I use the
SSHSCPClient ftpConnection;
//Successfully connected and able to upload the files but
ftpConnection.MultipleDeleteDirectories(remoteFolder);
it throws the error
[Message = "This operation is not currently supported."]

Just tried SSHSCPClient from v9.1.3.20 assembly, and using dotPeek found out that MultipleDeleteDirectories and all other delete methods are throwing not supported exception deliberately. Screenshot below. Or by any chance they have another privately distributed assembly, which has all the methods implemented...
edtFTPnetPRO looks a little bit outdated. Unless you have a good reason to use this library, I would recommend using SSH.NET which supports .NET Core, and is open source.

Related

Connect to Deprecated Sybase Database

I'm trying to connect to a Sybase Adaptive SQL Anywhere database that is running version 9. I'm currently trying to use iAnywhere.Data.AsaClient.dll. When I try to create a new connection,
AsaConnection myConnection = new AsaConnection();
I get System.IO.FileNotFoundException stating File dbdata9.dll was not found.
I can't find dbdata9.dll anywhere and it seems as if Sybase has long since deprecated that version. Is there anyway to get this file or are there any other tools that I can use to get access to this data programmatically?
I used Java instead, following this article with a few modifications. I have access to jconn4.jar so I was able to add that as a reference.

Firebird 1.5 / Asp net VS 2010 (legacy database .CDB extension)

I have an old system which generated me a database in .CDB extension (i run on Firebird-1.5.6.5026-0-Win32) and i can access this database in IBExpert to query and stuff. But i need to write an application in .NET (VS 2010 4.0 framaework) so i can read this database and access some of the data to insert into a table inside SQLServer.
I tried many things, changed the server version and other things but i now all i get is ''Cannot find fbembed.dll'' exception error while trying to open the connection. My FB server doesnt have this file since he uses the 'fbclient.dll' already.
Any thoughts on how to connect my application to this .CDB database?
(this firebird version is the same that the legacy system is running, so i used the 1.7RC firebird .net provider within this server)
The connection string used is:
<add name="FirebirdConnectionString" connectionString="User=SYSDBA;Password=masterkey;
Database=localhost:C:\temp\BD\E‌​CLECTIC.CDB;DataSource=localhost;Port=3051;
Dialect=3;Charset=NONE;Role=;Connectio‌​n lifetime=15; Pooling=false;
MinPoolSize=0; MaxPoolSize=50; Packet Size=8192; ServerType=1;"
providerName="FirebirdSql.Data.FirebirdClient"/>
Unless you really want to use Firebird embedded (which you don't as you also specify localhost), you should not specify ServerType=1, but either leave it out entirely or set ServerType=0.
As to your other problem you mention in the comments, I suggest you check if this solves it and otherwise create a new question with more information.

How do I make WebClient.DownloadFile() work with xnb, xgs, xsb, xwb files?

I'm creating an Updater program in C# for my PC game that basically sends an Http message to the server to find out what the latest version of the game is. If there is a newer version, it downloads the necessary files. To download the files I used the WebClient.DownloadFile() method. There are a few posts on the forums detailing problems with this method but none of them are quite like mine.
I use the method like this:
WebClient webClient = new WebClient();<br/>
webClient.DownloadFile(sOriginFile, sDestinationFile);
I immediately ran into a problem downloading any files with the following extensions:
.xnb
.xgs
.xsb
.xwb
I would get an exception stating "The remote server returned an error: (404) Not Found."
So as an experiment I added 3, more common, files to the same directory.
.txt
.doc
.jpg
and the DownloadFile() method worked perfectly for those files. Does anybody know why this method isn't working for the first 4 files types but works fine with the last 3?
Also I tried WebClient.DownloadData() and HttpWebRequest.GetResponse() (after setting up the request), I even tried reversing the extension name on the server (.bnx), but no matter what, I would get the same exact exception.
If anybody really wants to tackle this, here are links to 2 sample files (I tried to post all 7 sample files but Stack Overflow only allows me to post 2 links):
http://www.facepuncher.com/Versions/CastleAbra/1.1/Sample.txt
http://www.facepuncher.com/Versions/CastleAbra/1.1/UiCursor.xnb
Most likely the MIME-Settings for the file types you mention are set up incorrectly in IIS. Go to IIS Server Mananger -> MIME-Settings and add the file-types accordingly.
Probably a better idea to transfer any filetype would be to download only files like
file.xnb.dat
file.xgs.dat
and rename them locally.
-Matthias

connect to .mdf file in vs2010 , wpf application

I am using VS2010 , and I built a .mdf file using SQL server 2008
I want to use this database file in my wpf application so that I can add rows to it and delete rows from it
the problem is , I can't access this file , and all the insertion and deleting is actually hapening to the datacontexct i created .
I used myDataContexct.Submitchanges() but it didn't work either
I tried to add a connection string when I define the datacontexct that holds the url of my .mdf file and this it gave me a runtime error when trying to access this file and the error messege says :
An attempt to attach an auto-named database for file Trial.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
please help me because I searched alot but I couldn't find any help
If the application is not going to be installed in a manner that many clients are accessing the same server, you would want to consider using SQL Server Compact Edition.
Are you sure the connection string in your app.config refers to the local mdf file? perhaps it refers to the server instance?
What technology do you use, is it LinqToSql or Entity Framework (I think you have t call SaveChanges, not AcceptChanges)?
If you do intend to access the server instance, then the problem seems to be a security restriction.
Please add more details on statement no. 1, and I'll write further info.

how to disconnection access in my C# program?

I tried to compress my Access 2007 database like this:
System.Diagnostics.Process.Start(#"C:\Program Files\Microsoft Office\Office12\msaccess.exe",#"c:\Mydb.mdb /compact ");
In my C# program and I get this error:
You attempted to open a database that is already opened exclusively by user on machine . Try again when the database is available. (Error 3356)
I tried Conn.close() but still get the error
Thanks in advance.
Maybe connection pooling is the issue?
Not completely sure where connection pooling is implemented (I believe that this is just part of the provider e.g. SQL server and therefore might not be relevant to this issue)
But it will keep connections open between the client and server even thougth the connection object is set to "closed".
You can clear a sql server connection pool using conn.ClearPool
What are you using for the provider to connect to your database? (OLEDB?)
If so try ReleaseObjectPool()
Check your Task Manager to see if you have Access already open. If you do, close these instances and retry.
Maybe something went wrong and you just have an extra *.ldb file out there. Go to where your DB is stored:
c:\Mydb.ldb
If no one is using it delete the file.
The way compact & repair works in Access is it compacts to a new file, deletes the original file and then renames. You can use the DAO Engine to do the same thing. As far as I can tell from MS Visual C# 2010 Express, you can set a reference to DAO and use that:
var MyDBE=new DAO.DBEngine();
MyDBE.CompactDatabase("c:\\docs\\Mybe.mdb", "c:\\docs\\temp.mdb");
To ensure the database is not in use, you can check if the .ldb exists.
I am sorry, but I do not know anything about c#, so these notes are very crude.
//Edit begin
Check out these basic troubleshooting items:
http://office.microsoft.com/en-us/access-help/troubleshoot-compacting-repairing-or-recovering-an-access-file-HP005188316.aspx?queryid=728e1007c19b43bba069cb7f11364f7a&respos=0&CTT=1
See if any of the above reasons are causing the compact to fail!
//Edit end
Check the following link:
http://support.microsoft.com/kb/209207
Use /excl with the code to open it exclusively.
So code would be:
System.Diagnostics.Process.Start(#"C:\Program Files\Microsoft Office\Office12\msaccess.exe",#"c:\Mydb.mdb /excl /compact ");
By using the excl option you will be opening it exclusively!
Hope it helps!

Categories

Resources