我们希望以编程方式将表添加到本地存储的Microsoft SQL Server Compact 3.5数据库中.下面的代码创建表.
using (SqlCeConnection con =
new SqlCeConnection("Data Source=|DataDirectory|\\Database.sdf"))
{
con.Open();
using (SqlCeCommand com =
new SqlCeCommand("create table test (id int not null)", con))
{
Console.WriteLine("Response: " + com.ExecuteNonQuery());
}
con.Close();
}
Run Code Online (Sandbox Code Playgroud)
代码工作正常,但该表未在指定数据库表的服务器资源管理器中列出.我们可以在表中插入值并从表中读取数据.
你知道这个问题的解决方案吗?
之后我们想要添加一个动态数据模型,我们希望将其用作表的提供者.
先感谢您.
我目前正在尝试使用web服务作为ado.net edm的源代码.例如:http://odata.netflix.com/v2/Catalog/ $ metadata
我已经将web服务的xml存储在变量中,以便我可以在必要时使用它.有没有办法将web服务的数据与datamodel相关联,以便动态创建edm的表与webservice相关?
我只需要使用行名称和类型动态创建表.
最诚挚的问候朱利安