C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


(過去ログ 24 を表示中)
■10638 / )  Re[2]: 新規にデータプロバイダを組み込みたいしたい
□投稿者/ チャンタ (2回)-(2007/11/22(Thu) 21:50:19)
No10605 (魔界の仮面弁士 さん) に返信
> http://www.firebirdsql.org/index.php?op=devel&sub=netprovider&id=dotnetff200411
> を見る限りでは、
>>Added a new DataSet generator for the FbDataAdapter component.
>>★It allows to generate typed and untyped DataSets.★
>>The generated Typed Dataset will be added to the active Visual Studio project.
>>Supported Visual Studio versions are Visual Studio 2003/2005 and Visual C# Express.
> という表記もあるようですが。

どうやって行うのかが記述されていないので困っています。

http://www.firebirdsql.org/index.php?op=devel&sub=netprovider&id=faq#9
に以下の文を見つけました。
以下のコードを記述すればDataSetの生成ができますと解釈したのですが
1:どこに記述すればよいのか
2:VisualBasic言語ではないがどうしたものか
3:StreamWriter等通常の環境では定義されていないオブジェクト?が
  あるがどう対処したらよいのか
と3点がわからず困っています。
なにかわかれば教えて下さい。
−−−−
9. Can i generate type datasets at design time using the FbDataAdapter component ?

No, design time support is limited to the FbConnection and FbCommand components.

You can generate typed datasets by code using the TypedDataSetGenerator .NET class.

FbConnection connection = new FbConnection(connectionString);

DataSet employees = new DataSet("Employees");
FbCommand command = new FbCommand("select * from employee", connection);
FbDataAdapter adapter = new FbDataAdapter(command);
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

adapter.Fill(employees, "Employees");

// Generate the employee TypedDataSet
string fileName = @"d:\employee.cs";

StreamWriter tw = new StreamWriter(new FileStream(fileName,
FileMode.Create,
FileAccess.Write));

CodeNamespace cn = new CodeNamespace("employees");
CSharpCodeProvider cs = new CSharpCodeProvider();

System.Data.Design.TypedDataSetGenerator.Generate(dataSet, codeNamespace, csharpCodeProvider);

cg.GenerateCodeFromNamespace(cn, tw, null);

tw.Flush();
tw.Close();

employees.WriteXmlSchema(@"d:\employee.xsd");

connection.Close();
−−−−

返信 編集キー/


管理者用

- Child Tree -