msde premission

H

Hei

Hi

i'm try a asp.net web page that access msde, i think these problem is about
premission.
i have

1. added a login to msde named 'Database Users' and
2. grant windows user group 'Database Users' to that login, also
3. add 'ASPNET' to windows user group 'Database Users'.

but still not work. pls help
 
J

Jerry Boone

Does it work using the sa account? If so, then you definitely have a
permission problem.

You either need to use osql to execute statements that add/remove users
(sp_addlogin, sp_adduser, sp_grantlogin, sp_grantdbaccess, etc..) -- or get
your hands on a copy of Enterprise Manager that comes with Sql Server -- or
if you have Microsoft Access 2000 you can start a new "Project", connect to
MSDE, and you can control logins and things from the tools menu.

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
Secure Hosting and Development Solutions for ASP, ASP.NET, SQL Server, and
Access
 
F

Franco Figún

Hi
What is the exactly error?
Show me the connection or the code for you example
 
H

Hei

i work suddenly, is it because need to restart msde
after i add login(mentioned in first post)??
 
F

Franco Figún

Try this code, and tell me what you see:

<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<TITLE>ADO.NET</TITLE>
</HEAD>
<BODY>
<%
Dim objConexion As SqlConnection
Dim objComando As SqlCommand
Dim objDataReader As SqlDataReader
Dim intContador As Integer

objConexion = New SqlConnection("server=PC;uid=sa;pwd=;database=northwind")
objConexion.Open()

objComando = New SqlCommand("Select * From categories", objConexion)
objDataReader = objComando.ExecuteReader()
%>
<%
intContador = 1
Response.Write("<TABLE
BORDER=1><TR><TD>NRO</TD><TD>ID</TD><TD>NOMBRE</TD></TR>")

While objDataReader.Read
Response.Write("<TR><TD>" & intContador & ".</TD><TD>" &
objDataReader.Item("categoryID") & "</TD><TD>" &
objDataReader.Item("categoryname") & "</TD></TR>")
intContador = intContador + 1
End While

Response.Write("</TABLE>")
objDataReader.Close()
objConexion.Close()
%>
</BODY>
</HTML>
------------------------------------------------------------------
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, e As EventArgs)
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
' Create a connection to the "pubs" SQL database located on the
' local computer.
myConnection = New SqlConnection("server=localhost;" _
& "database=pubs;Trusted_Connection=Yes")
' Connect to the SQL database using a SQL SELECT query to get all
' the data from the "Authors" table.
myCommand = new SqlDataAdapter("SELECT * FROM Authors", _
myConnection)
' Create and fill a DataSet.
Dim ds As DataSet = new DataSet()
myCommand.Fill(ds)
' Bind MyDataGrid to the DataSet. MyDataGrid is the
' ID for the DataGrid control in the HTML section.
MyDataGrid.DataSource = ds
MyDataGrid.DataBind()
End Sub
</script>

<body>
<h3><font face="Verdana">
Simple Select to a DataGrid Control.
</font></h3>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
</body>
</html>
 
H

Hei

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server
connection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'sa'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 15:
Line 16: objConexion = New
SqlConnection("server=(local);uid=sa;pwd=;database=northwind")
Line 17: objConexion.Open()
Line 18:
Line 19: objComando = New SqlCommand("Select * From categories",
objConexion)


Cannot open database requested in login 'pubs'. Login fails. Login failed
for user 'WILLIAM2\ASPNET'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database
requested in login 'pubs'. Login fails. Login failed for user
'WILLIAM2\ASPNET'.

Source Error:

Line 16: ' Create and fill a DataSet.
Line 17: Dim ds As DataSet = new DataSet()
Line 18: myCommand.Fill(ds)
Line 19: ' Bind MyDataGrid to the DataSet. MyDataGrid is the
Line 20: ' ID for the DataGrid control in the HTML section
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top