数据库中的用户验证 [英] User validation in database

查看:138
本文介绍了数据库中的用户验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

翻译:
我应该使用编写哪些代码,以使用Visual Studio验证一个用户到数据库的身份?

原始文本:

Translation:
Which code should I use write to validate one user to a database using visual studio?

Original Text:
¿Que codigo uso para poder validar un usuario en visual studio de una base de datos?

推荐答案

好吧,因为我无法100%理解您的想法.我将回答您可能谈论的所有三件事.
首先,我假设您使用Visual Studio的MSSQL或大多数Visual Studio内置的MSSQL Express.

通过简单的连接字符串在web.config页中概述了从Visual Studio应用程序连接到VB或C +到数据库的身份验证,如下所示:

Well, because I can not get 100% of what your talking about. I will answer all of the three things you might be talking about.
First off I am going to assume you are using MSSQL with visual studio, or MSSQL Express that most of the Visual studios have built into it.

Authentication to connect to a database from a visual studio application be it VB or C+ is outlined in the web.config page with a simple connection string, like so:

<add connectionstring="Server=SQLServer;Database=DatabaseName;UserID=DatabaseUser;Password=DatabasePassword" name="ConnectionStringName" providername="System.Data.SqlClient" />



现在,一旦完成此操作,就可以开始在代码或前端向导中引用连接字符串(该向导从数据源"的下拉列表中选择您的连接字符串名称.

至于代码(我假设您使用的是vb.net),您可以这样称呼



Now once you have done this you can start referring to the connection string in either code or the front end wizards (The wizard select your connection string name from the drop down list in "Data sources"

As for in code (I will assume you are using vb.net) you can call it like so

Dim cnn As New Odbc.OdbcConnection
cnn.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionStringName").ConnectionString



如果您当然是在谈论对应用程序启用.Net身份验证(也可以通过web.config进行控制),我建议您阅读一下ASP应用程序的身份验证级别,Visual Studio向导可以为这些应用程序创建这些身份验证数据库.您将从调查.Net用户身份验证中学到的知识.

扎克(Zac)



If of course you are speaking about enabled .Net authentication to your application (Which is also controlled via the web.config) I would suggest reading up a little on the authentication levels of ASP apps, the visual studio wizard can create these authentication databases for you which you will learn from investigating the .Net user auth.

Zac


这篇关于数据库中的用户验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆