powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Помогите, плиз, начинающему
1 сообщений из 1, страница 1 из 1
Помогите, плиз, начинающему
    #32773948
Andrei_A
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Похелпайте плиз. Может даже не туда написал.

Захотелось мне очень отразить на вебе данные из SQL Server -ных таблиц. Но на счет веба знания нулевые. Поставил Win2k3, включил роли чтобы якобы ASP работало. Нарыл код в инете - чутка поправил. Получилось следующее (чти сырец ниже). Открываю страничку сию - результат нулевой. Даже у строки Resul of - ничего нет. Толи я ASP не так юзаю, то ли вообще лыжи не едут. Скажите где я не туды тыкаю.

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
<%
Dim DataConn, cmdDC, rsDC
Dim Item
Dim iFieldCount, iLoopVar
Dim strLTorGT, iCriteria, strSortBy, strOrder

' Retrieve QueryString Variables and convert them to a usable form





' Create and establish data connection
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.ConnectionTimeout =  15 
DataConn.CommandTimeout =  30 


'Our SQL Server code - use above line to use sample on your server
DataConn.Open "Provider=SQLOLEDB;Data Source=192.168.0.1;" _
	& "Initial Catalog=rsvbase;User Id=sa;Password=sa;" _
	& "Connect Timeout=15;Network Library=dbmssocn;"


' Create and link command object to data connection then set attributes and SQL query
Set cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = DataConn
cmdDC.CommandText = "SELECT * FROM Products;"
cmdDC.CommandType =  1 

' Create recordset and retrieve values using command object
Set rsDC = Server.CreateObject("ADODB.Recordset")
' Opening record set with a forward-only cursor (the  0 ) and in read-only mode (the  1 )
rsDC.Open cmdDC, ,  0 ,  1 
%>

<p><strong>Results of <%= cmdDC.CommandText %></strong></p>

<table border="1">
	<thead>
	<tr>
<% For Each Item in rsDC.Fields %>
		<th><%= Item.Name %></th>
<% Next %>
	</tr>
	</thead>
<%
' Loop through recordset and display results
If Not rsDC.EOF Then rsDC.MoveFirst

' Get the number of fields and subtract one so our loops start at  0 
iFieldCount = rsDC.Fields.Count -  1 

' Continue till we get to the end, and while in each <TR> loop through fields
Do While Not rsDC.EOF
%>	<tr>
		<% For iLoopVar = 0 to iFieldCount %>
		<td><%= rsDC.Fields(iLoopVar) %></td>
		<% Next %>
	</tr>
<%
rsDC.MoveNext
Loop
%>
</table>

<%
' Close Data Access Objects and free DB variables
	rsDC.Close
	Set rsDC =  Nothing
	' can't do a "cmdDC.Close" !
	Set cmdDC = Nothing
	DataConn.Close
	Set DataConn = Nothing
%>

<br />

...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Помогите, плиз, начинающему
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]