简体   繁体   English

连接到SQL Server数据库C#-WinForms

[英]Connecting to SQL Server Database C#-WinForms

I have a desktop app that I'm making and I want users to have to login before the program can be used to its fullest extent. 我有一个正在制作的桌面应用程序,希望用户必须登录才能充分利用该程序。 I have created a database on www.winhost.com (where my site's hosted), but now I don't know what to do. 我已经在www.winhost.com(托管我的网站)上创建了一个数据库,但是现在我不知道该怎么办。 I've been on google and msdn and I would like to know how to programmatically add new rows/colums to this new database which is currently empty. 我去过google和msdn,我想知道如何以编程方式向此新数据库(当前为空)添加新的行/列。 And how I can update the database with new account info/get information from it. 以及如何使用新帐户信息更新数据库/从中获取信息。

I'm not expecting code or anything, just maybe a few good simple tutorials or something, since I haven't found what I'm looking for yet... 我没期待代码或任何东西,可能只是一些不错的简单教程之类的东西,因为我还没有找到想要的东西...

Here is a beginners guide to accessing SQL Server using C#: http://www.codeproject.com/KB/database/sql_in_csharp.aspx 这是使用C#访问SQL Server的初学者指南: http : //www.codeproject.com/KB/database/sql_in_csharp.aspx

Hope it helps :) 希望能帮助到你 :)

You probably want to add a web service to your website either through WCF or an ASMX file or maybe an ASHX file. 您可能想通过WCF或ASMX文件或ASHX文件将Web服务添加到您的网站。 Your desktop app would ping that service and ask if the user is registered. 您的桌面应用程序会对该服务执行ping操作,并询问用户是否已注册。 If so, it would unlock the app, otherwise it would ask them to register and hit another service method that would add the record to the DB. 如果是这样,它将解锁应用程序,否则将要求他们注册并点击另一种将记录添加到数据库的服务方法。

The defacto technology to connect to databases in the .Net world is ADO.net 连接到.Net世界中数据库的事实上的技术是ADO.net

There are tons of tutorials on how to get started on the web... 关于如何开始使用网络的大量教程...

This video is a good start: http://windowsclient.net/learn/video.aspx?v=30440 There are others on this topic on the same site. 该视频是一个好的开始: http : //windowsclient.net/learn/video.aspx?v= 30440在同一网站上还有其他与此主题有关的内容。 A ADO.net book that I liked is "Pro ADO.NET 2.0", published by APress. 我喜欢的一本ADO.net书籍是APress出版的“ Pro ADO.NET 2.0”。

I hope to have answered your question. 我希望能回答您的问题。 It is not very clear whether your question is about user authentication or updating the database... 不清楚您的问题是关于用户身份验证还是更新数据库...

If the problem is that you are not sure how to reach the database that is hosted on their servers, the best may be to contact the hosting company's support. 如果问题是您不确定如何访问其服务器上托管的数据库,则最好的方法是与托管公司的支持联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM