客户端-服务器数据库应用程序

问题描述:

我不知道在哪里发布我的问题,如果我发错了它,请原谅我.

I don't know where to post my question, please forgive me if I have post it wrongly. 

我是数据库编程的新手.我需要为我的项目使用C#数据库开发客户端-服务器应用程序.

I am a newbie in database programming. I need to develop client-server application with database in C# for my project.

我的情况是数据库位于服务器中,我需要开发一个客户端应用程序以连接到数据库并更新数据库.

My scenario is the database is locate in server and I need to develop a client application to connect to database and make update to the database.

我有google并尝试了一些示例,但仍然失败.我可以使用指定的数据库位置连接到我的本地数据库,但是当我将连接字符串更改为"localhost"时,会出现一个异常,其中键的值无效" 'attachdbfilename."

I have google and tries some example but I still fail to do it. I'm able to connect to my local database with specify the database location, but when I change the connection string to "localhost", an exception will raised with "Invalid value for key 'attachdbfilename."

我当前的连接字符串是  conn = new SqlConnection(@``数据源=(本地)\ SQLEXPRESS; AttachDbFilename = | DataDirectory | \ NetworkBasedLogin.mdf;集成安全性= True;用户实例= True'');

My current connection string was  conn = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NetworkBasedLogin.mdf;Integrated Security=True;User Instance=True");

谢谢.  

thank you.  

| DataDirectory | \ NetworkBasedLogin.mdf必须是您计算机上的文件.纠正路径,它应该可以工作.
|DataDirectory|\NetworkBasedLogin.mdf must be a file on you machine. Correct the path and it should work.