200份求救:System.Data.SqlClient.SqlException: SQL Server 不存在或访问被拒绝。
System.Data.SqlClient.SqlException: SQL Server 不存在或访问被拒绝。
System.Data.SqlClient.SqlException: SQL Server 不存在或访问被拒绝。
2003-09-03 08:03:08 com_gao(52022920)
有谁了解sql....我很郁闷。
所有连接sql的操作都不成功!!!
winserver2000...+sqlserver2000...+iis5...
+vs.net...
我使用.net(中文)自带的例子都通不过。说找不到sql服务器...有没有人遇到过类似的。我第一接触mssqlserver2000...的编程
2003-09-03 08:04:05 DemonHunter(76763831)
sql服务打开没?
2003-09-03 08:04:16 com_gao(52022920)
打开了
2003-09-03 08:04:52 DemonHunter(76763831)
用服务管理器刷新一下
2003-09-03 08:05:28 com_gao(52022920)
Microsoft .NET Framework SDK 快速入门、教程和示例
这里的例子,你也装了吧,与数据库的操作就不通过
2003-09-03 08:05:57 DemonHunter(76763831)
我看看
2003-09-03 08:07:08 DemonHunter(76763831)
找不到~~~
2003-09-03 08:07:41 com_gao(52022920)
你装了.net环境了没有
2003-09-03 08:08:04 DemonHunter(76763831)
嗯
我说找不到数据库操作的例子
2003-09-03 08:08:18 com_gao(52022920)
就在asp.net快速入门
2003-09-03 08:08:35 com_gao(52022920)
然后找 ASP.NET Web 窗体
2003-09-03 08:08:47 DemonHunter(76763831)
ok
2003-09-03 08:09:04 com_gao(52022920)
服务器端数据访问
目录里,随便找个例子运行一下
2003-09-03 08:10:13 DemonHunter(76763831)
我的可以啊
2003-09-03 08:10:30 com_gao(52022920)
阿?我的数据库的问题????
2003-09-03 08:10:51 DemonHunter(76763831)
应该是吧
2003-09-03 08:10:51 com_gao(52022920)
http://localhost/quickstart/aspplus/samples/webforms/customize/VB/datalist1.aspx
你打这个例子
2003-09-03 08:11:20 com_gao(52022920)
错误是:[SqlException: SQL Server 不存在或访问被拒绝。]
2003-09-03 08:11:52 DemonHunter(76763831)
我的可以显示那个藏书室
2003-09-03 08:12:42 com_gao(52022920)
你的sql设密码了没?
2003-09-03 08:12:47 DemonHunter(76763831)
嗯
2003-09-03 08:13:06 com_gao(52022920)
你的sql默认的用户是sa把?
2003-09-03 08:13:11 DemonHunter(76763831)
嗯
2003-09-03 08:13:51 com_gao(52022920)
你安装的时候选择的是用系统用户登录还是sql和系统混和登录
2003-09-03 08:14:09 DemonHunter(76763831)
后者
2003-09-03 08:14:20 com_gao(52022920)
我也是阿
2003-09-03 08:14:27 DemonHunter(76763831)
y ....
2003-09-03 08:14:42 DemonHunter(76763831)
你有权限没?
2003-09-03 08:14:52 com_gao(52022920)
问题在那???????
我用的是administrator..
2003-09-03 08:14:59 com_gao(52022920)
登录
2003-09-03 08:15:32 DemonHunter(76763831)
不懂~
问题点数:0、回复次数:5Top
1 楼liuyun2003(流云(老老实实做人,认认真真还贷))回复于 2003-09-03 08:52:48 得分 0
晕,看不懂啊。Top
2 楼pengdali()回复于 2003-09-03 09:19:22 得分 0
企业管理器-->右键你的实例(就是那个有绿色图标的)-->属性-->安全-->改为sql与window混合
如果还不行:
sqlserver服务器-->开始菜单-->SQLserver-->服务器网络实用工具-->启用 WinSock代理-->代理地址:(sqlserver服务器IP)-->代理端口-->1433-->OK了
再用ip地址直接连
Top
3 楼txlicenhe(马可)回复于 2003-09-03 09:25:20 得分 0
也许是前台的连接语句有问题,贴出来看看。Top
4 楼nboys()回复于 2003-09-03 10:19:45 得分 0
MasterChild.aspx
<%@Page Language="VB" Inherits="BaseClass" Src="MasterChild.vb" %>
<html>
<head>
<title>DataGrid Samples - Step 3</title>
</head>
<body>
<h1> Master Child Example </h1>
<form runat=server>
<table width="95%">
<tr>
<td valign="top">
<b>Authors:</b><br>
<asp:DataGrid id="authorsGrid" runat="server"
AutoGenerateColumns="false"
BackColor="White"
BorderWidth="1px" BorderStyle="Solid" BorderColor="Tan"
CellPadding="2" CellSpacing="0"
Font-Name="Verdana" Font-Size="8pt"
DataKeyField="au_id"
OnSelectedIndexChanged="Grid_Select"
>
<Columns>
<asp:ButtonColumn Text="Select" CommandName="Select"/>
<asp:BoundColumn HeaderText="ID" DataField="au_id">
<HeaderStyle Width="100px"> </HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Name" DataField="au_name">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="State" DataField="state">
<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundColumn>
</Columns>
<HeaderStyle BackColor="DarkRed" ForeColor="White" Font-Bold="true">
</HeaderStyle>
<ItemStyle ForeColor="DarkSlateBlue">
</ItemStyle>
<AlternatingItemStyle BackColor="Beige">
</AlternatingItemStyle>
<SelectedItemStyle BackColor="PaleGoldenRod" Font-Bold="true">
</SelectedItemStyle>
</asp:DataGrid>
</td> <vr>
<td valign="top">
<asp:Panel id="detailsPanel" runat="server" Visible="false">
<table border="0" cellspacing="0" cellpadding="2" width="100%"
style="font-family: verdana; font-size: 8pt">
<b>Titles:</b><br>
<td colspan="2">
<asp:DataGrid id="titlesGrid" runat="server"
AutoGenerateColumns="false"
ShowFooter="true"
BackColor="White"
BorderWidth="1px" BorderStyle="Solid" BorderColor="Tan" CellPadding="2" CellSpacing="0"
Font-Name="Verdana" Font-Size="8pt"
>
<Columns>
<asp:BoundColumn HeaderText="ID" DataField="title_id">
<HeaderStyle Width="100px">
</HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Title" DataField="title">
<HeaderStyle Width="250px">
</HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Published" DataField="pubdate" DataFormatString="{0:MMM yyyy}">
<HeaderStyle Width="100px">
</HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Price" DataField="price" DataFormatString="{0:c}">
<HeaderStyle Width="50px">
</HeaderStyle>
<ItemStyle HorizontalAlign="Right">
</ItemStyle>
</asp:BoundColumn>
</Columns>
<HeaderStyle BackColor="DarkRed" ForeColor="White" Font-Bold="true">
</HeaderStyle>
<FooterStyle BackColor="Tan">
</FooterStyle>
<ItemStyle ForeColor="DarkSlateBlue">
</ItemStyle>
<AlternatingItemStyle BackColor="Beige">
</AlternatingItemStyle>
</asp:DataGrid>
</td>
</tr>
</table>
</asp:Panel>
</td> </tr>
</table>
</form>
</body>
</html>
Top
5 楼nboys()回复于 2003-09-03 10:21:45 得分 0
MasterChild.vb
Imports System
Imports System.Collections
Imports System.Text
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class BaseClass
Inherits System.Web.UI.Page
Protected AuthorsGrid as DataGrid
protected titlesGrid as DataGrid
protected detailsPanel as Panel
Public currentAuthor as object
Dim myConnection As OleDbConnection
Dim myCommand As OleDbDataAdapter
Dim ds As New DataSet
Dim ConnStr As String
Dim SQL As String
Sub Page_Load(Source As Object, E As EventArgs)
ConnStr = "Provider=SQLOLEDB; Data Source=(local); Initial Catalog=pubs;User ID=sa;PWD=pwd"
myConnection = New OleDbConnection(ConnStr)
if NOT (isPostBack)
rebind
end if
End Sub
Sub FillDs
sql = " select * , au_lname + ',' + au_fname as au_name"
sql = sql + " From authors a, titles t, titleauthor ta"
sql = sql + " Where a.au_id = ta.au_id AND t.title_id = ta.title_id"
myCommand = New OleDbDataAdapter(SQL, myConnection)
'use Fill method of DataSetCommand to populate dataset
myCommand.Fill(ds, "Authors")
end Sub
Sub ReBind()
FillDs
'Binding a Grid
AuthorsGrid.DataSource=ds.Tables("Authors").DefaultView
AuthorsGrid.DataBind()
End Sub
'
Sub Grid_Select(sender as Object , e as EventArgs)
Dim vIndex As Integer
Dim vkey as string
vIndex = AuthorsGrid.SelectedIndex
vkey =AuthorsGrid.DataKeys(vIndex).ToString
UpdateSelection(vkey)
end sub
Sub UpdateSelection(vkey as string)
Dim myConnection2 As OleDbConnection
Dim myCommand2 As OleDbDataAdapter
Dim ds2 As New DataSet
Dim ConnStr2 As String
Dim SQL2 As String
Dim itemcount As Integer
sql2 = " select * , au_lname + ',' + au_fname as au_name"
sql2 = sql2 + " From authors a, titles t, titleauthor ta"
sql2 = sql2 + " Where a.au_id = ta.au_id AND t.title_id = ta.title_id"
sql2 = sql2 + " AND a.au_id = '" + vkey + "'"
myCommand2 = New OleDbDataAdapter(SQL2, myConnection)
myCommand2.Fill(ds2, "Authors")
'Bind the Grid
titlesGrid.DataSource=ds2.Tables("Authors").DefaultView
titlesGrid.DataBind()
itemcount = titlesGrid.Items.Count
if itemcount >= 1 then
detailsPanel.Visible = true
Else
detailsPanel.Visible = false
response.write("No rows found")
end if
End sub
End Class
Top
6 楼nboys()回复于 2003-09-03 10:22:40 得分 0
MasterChild.aspx
<%@Page Language="VB" Inherits="BaseClass" Src="MasterChild.vb" %>
<html>
<head>
<title>DataGrid Samples - Step 3</title>
</head>
<body>
<h1> Master Child Example </h1>
<form runat=server>
<table width="95%">
<tr>
<td valign="top">
<b>Authors:</b><br>
<asp:DataGrid id="authorsGrid" runat="server"
AutoGenerateColumns="false"
BackColor="White"
BorderWidth="1px" BorderStyle="Solid" BorderColor="Tan"
CellPadding="2" CellSpacing="0"
Font-Name="Verdana" Font-Size="8pt"
DataKeyField="au_id"
OnSelectedIndexChanged="Grid_Select"
>
<Columns>
<asp:ButtonColumn Text="Select" CommandName="Select"/>
<asp:BoundColumn HeaderText="ID" DataField="au_id">
<HeaderStyle Width="100px"> </HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Name" DataField="au_name">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="State" DataField="state">
<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundColumn>
</Columns>
<HeaderStyle BackColor="DarkRed" ForeColor="White" Font-Bold="true">
</HeaderStyle>
<ItemStyle ForeColor="DarkSlateBlue">
</ItemStyle>
<AlternatingItemStyle BackColor="Beige">
</AlternatingItemStyle>
<SelectedItemStyle BackColor="PaleGoldenRod" Font-Bold="true">
</SelectedItemStyle>
</asp:DataGrid>
</td> <vr>
<td valign="top">
<asp:Panel id="detailsPanel" runat="server" Visible="false">
<table border="0" cellspacing="0" cellpadding="2" width="100%"
style="font-family: verdana; font-size: 8pt">
<b>Titles:</b><br>
<td colspan="2">
<asp:DataGrid id="titlesGrid" runat="server"
AutoGenerateColumns="false"
ShowFooter="true"
BackColor="White"
BorderWidth="1px" BorderStyle="Solid" BorderColor="Tan" CellPadding="2" CellSpacing="0"
Font-Name="Verdana" Font-Size="8pt"
>
<Columns>
<asp:BoundColumn HeaderText="ID" DataField="title_id">
<HeaderStyle Width="100px">
</HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Title" DataField="title">
<HeaderStyle Width="250px">
</HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Published" DataField="pubdate" DataFormatString="{0:MMM yyyy}">
<HeaderStyle Width="100px">
</HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn HeaderText="Price" DataField="price" DataFormatString="{0:c}">
<HeaderStyle Width="50px">
</HeaderStyle>
<ItemStyle HorizontalAlign="Right">
</ItemStyle>
</asp:BoundColumn>
</Columns>
<HeaderStyle BackColor="DarkRed" ForeColor="White" Font-Bold="true">
</HeaderStyle>
<FooterStyle BackColor="Tan">
</FooterStyle>
<ItemStyle ForeColor="DarkSlateBlue">
</ItemStyle>
<AlternatingItemStyle BackColor="Beige">
</AlternatingItemStyle>
</asp:DataGrid>
</td>
</tr>
</table>
</asp:Panel>
</td> </tr>
</table>
</form>
</body>
</html>
Top




