I'veは次れたconnectionStringを得ました。 mdfファイルは、Datenbank
というフォルダにあります。これは、接続文字列に入力したフォルダにあります。のConnectionString MDFファイル
..\\
と思われます。 誰かがその問題の解決策を持っていますか?
I'veは次れたconnectionStringを得ました。 mdfファイルは、Datenbank
というフォルダにあります。これは、接続文字列に入力したフォルダにあります。のConnectionString MDFファイル
..\\
と思われます。 誰かがその問題の解決策を持っていますか?
次のコードを使用してdirを計算できます。
//these two lines get the executable's directory
Uri u = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase);
DirectoryInfo d = new DirectoryInfo(Path.GetDirectoryName(u.LocalPath));
//this goes up two directories and combines that directory with the rest
//of the path to the file
string path = Path.Combine(d.Parent.Parent.FullName, @"Datenbank\FarmersCalc.mdf;");
Console.WriteLine(path);
パスにGetDirectoryNameの定義が含まれていません... – user896692
どのバージョンのcsharpを使用していますか?明らかにこれが動作するには、 'System.IO'と' System.Reflection'名前空間を含める必要があります。私はそれが問題だとは思っていません。それをそこに置くだけです。 –
あなたが見ているエラーは何ですか? –
私は信じて| DataDirectory |プロジェクトフォルダの下にある "App_Data"フォルダを指します。 –
タイトルに「C#」などのプレフィックスを付けないでください。それがタグのためのものです。 –