473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems with SQL server & asp

I am using an asp page to access data stored by Microsoft SQL in a SQL server
database. I cannot get all values to return, some display as blanks.

I am using IIS v5, Microsoft SQL Server 2000, running on Windows Advanced
Server 2000 SP4.

Here is my asp code, SQL table create statements, CSV example data and
output. As can be seen by the output, the pc_model and manufacturer fields
display blank although these fields hold text data in my test database. Has
anyone else encountered similar problems/ know of any issues/ got any info at
all to share on this one?
================================================== ===

ASP CODE:

<%@ Language=VBScript %>
<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</head>
<body>

</body>
</html>
<%
'Script reads values from a Microsoft SQL database & displays them

Dim conn
Dim dbPcModel 'PC Model
Dim dbPcManufacturer 'PC Make
Dim dbPcSpeed 'Processor speed
Dim dbSN 'PC Serial Number
Dim dbRam 'Memory (MHz)
Dim dbHdd 'Disk Capacity
Dim dbCpu 'Processor type
Dim dbOs 'Operating System
Dim dbType 'PC Type (desktop/laptop)
Dim dbCost 'Cost Centre

QueryDatabase()

'
' Method: QueryDatabase
'
' Author: Iain Worlock
' Description: This subroutine retrieves the users asset record from the
database
' Date of last update: 16/08/2004
'
Sub QueryDatabase
Dim dbrs
Dim results
Dim ownerEmail

ownerEmail = "ia**********@hp.com"

' Open database query
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=asset_tracker"

Set dbrs = conn.Execute("select * from test2 where email like '" +
ownerEmail + "'")
Set results = dbrs.Fields
dbSN = results.Item("serial_number").Value
dbPcModel = results.Item("pc_model").Value
dbPcManufacturer = results.Item("manufacturer").Value
dbPcSpeed = results.Item("cpu_mhz").Value
dbRam = results.Item("ram_mb").Value
dbHdd = results.Item("hdd_gb").Value
dbCpu = results.Item("processor").Value
dbOs = results.Item("os").Value
dbType = results.Item("type").Value
dbCost = results.Item("cost_centre").Value
response.Write("serial is: " + dbSN +"<BR>")
response.Write("model is: " + dbPcModel +"<BR>")
response.Write("make is: " + dbPcManufacturer +"<BR>")
response.Write("speed is: " + CStr(dbPcSpeed) +"<BR>")
response.Write("mem is: " + CStr(dbRam) +"<BR>")
response.Write("storage is: " + CStr(dbHdd) +"<BR>")
response.Write("processor speed is: " + CStr(dbCpu) +"<BR>")
response.Write("OS is: " + dbOs +"<BR>")
response.Write("processor type is: " + dbType +"<BR>")
response.Write("cost centre is: " + dbCost +"<BR>")
End Sub
%>

MICROSOFT SQL TABLE:

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[test2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[test2]
GO

CREATE TABLE [dbo].[test2] (
[pkindex] [int] NOT NULL ,
[email] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[pc_model] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[manufacturer] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[serial_number] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cpu_mhz] [int] NULL ,
[ram_mb] [int] NULL ,
[hdd_gb] [int] NULL ,
[processor] [int] NULL ,
[os] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[type] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cost_centre] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
DATA (CSV):

1, ia**********@hp.com, model=evo, make=compaq, serial=2345, 1800, 384, 40,
9999, os=win, type=p3, cost=null

OUTPUT:

<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</head>
<body>

serial is: serial=2345<BR>
model is: <BR>
make is: <BR>
speed is: 1800<BR>
mem is: 384<BR>
storage is: 40<BR>
processor speed is: 9999<BR>
OS is: os=win<BR>
processor type is: type=p3<BR>
cost centre is: cost=null<BR>
</body>
</html>

================================================== ===
Nov 18 '05 #1
2 1406
Considering you're posting an ASP question to an ASP.Net newsgroup, I'm not
surprised you're having problems! Try posting on
microsoft.public.inetserver.asp.general instead.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Sunny" <Su***@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
I am using an asp page to access data stored by Microsoft SQL in a SQL server database. I cannot get all values to return, some display as blanks.

I am using IIS v5, Microsoft SQL Server 2000, running on Windows Advanced
Server 2000 SP4.

Here is my asp code, SQL table create statements, CSV example data and
output. As can be seen by the output, the pc_model and manufacturer fields display blank although these fields hold text data in my test database. Has anyone else encountered similar problems/ know of any issues/ got any info at all to share on this one?
================================================== ===

ASP CODE:

<%@ Language=VBScript %>
<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</head>
<body>

</body>
</html>
<%
'Script reads values from a Microsoft SQL database & displays them

Dim conn
Dim dbPcModel 'PC Model
Dim dbPcManufacturer 'PC Make
Dim dbPcSpeed 'Processor speed
Dim dbSN 'PC Serial Number
Dim dbRam 'Memory (MHz)
Dim dbHdd 'Disk Capacity
Dim dbCpu 'Processor type
Dim dbOs 'Operating System
Dim dbType 'PC Type (desktop/laptop)
Dim dbCost 'Cost Centre

QueryDatabase()

'
' Method: QueryDatabase
'
' Author: Iain Worlock
' Description: This subroutine retrieves the users asset record from the
database
' Date of last update: 16/08/2004
'
Sub QueryDatabase
Dim dbrs
Dim results
Dim ownerEmail

ownerEmail = "ia**********@hp.com"

' Open database query
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=asset_tracker"

Set dbrs = conn.Execute("select * from test2 where email like '" +
ownerEmail + "'")
Set results = dbrs.Fields
dbSN = results.Item("serial_number").Value
dbPcModel = results.Item("pc_model").Value
dbPcManufacturer = results.Item("manufacturer").Value
dbPcSpeed = results.Item("cpu_mhz").Value
dbRam = results.Item("ram_mb").Value
dbHdd = results.Item("hdd_gb").Value
dbCpu = results.Item("processor").Value
dbOs = results.Item("os").Value
dbType = results.Item("type").Value
dbCost = results.Item("cost_centre").Value
response.Write("serial is: " + dbSN +"<BR>")
response.Write("model is: " + dbPcModel +"<BR>")
response.Write("make is: " + dbPcManufacturer +"<BR>")
response.Write("speed is: " + CStr(dbPcSpeed) +"<BR>")
response.Write("mem is: " + CStr(dbRam) +"<BR>")
response.Write("storage is: " + CStr(dbHdd) +"<BR>")
response.Write("processor speed is: " + CStr(dbCpu) +"<BR>")
response.Write("OS is: " + dbOs +"<BR>")
response.Write("processor type is: " + dbType +"<BR>")
response.Write("cost centre is: " + dbCost +"<BR>")
End Sub
%>

MICROSOFT SQL TABLE:

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[test2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[test2]
GO

CREATE TABLE [dbo].[test2] (
[pkindex] [int] NOT NULL ,
[email] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[pc_model] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[manufacturer] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[serial_number] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cpu_mhz] [int] NULL ,
[ram_mb] [int] NULL ,
[hdd_gb] [int] NULL ,
[processor] [int] NULL ,
[os] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[type] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cost_centre] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
DATA (CSV):

1, ia**********@hp.com, model=evo, make=compaq, serial=2345, 1800, 384, 40, 9999, os=win, type=p3, cost=null

OUTPUT:

<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</head>
<body>

serial is: serial=2345<BR>
model is: <BR>
make is: <BR>
speed is: 1800<BR>
mem is: 384<BR>
storage is: 40<BR>
processor speed is: 9999<BR>
OS is: os=win<BR>
processor type is: type=p3<BR>
cost centre is: cost=null<BR>
</body>
</html>

================================================== ===

Nov 18 '05 #2
This is a .NET newsgroup, so you might want to consider posting elsewhere.

Just eyeballing the code, I don't see what the problem is. That said, I
would not recommend using text as the datatype in most of the places where
you're using it.

"Sunny" wrote:
I am using an asp page to access data stored by Microsoft SQL in a SQL server
database. I cannot get all values to return, some display as blanks.

I am using IIS v5, Microsoft SQL Server 2000, running on Windows Advanced
Server 2000 SP4.

Here is my asp code, SQL table create statements, CSV example data and
output. As can be seen by the output, the pc_model and manufacturer fields
display blank although these fields hold text data in my test database. Has
anyone else encountered similar problems/ know of any issues/ got any info at
all to share on this one?
================================================== ===

ASP CODE:

<%@ Language=VBScript %>
<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</head>
<body>

</body>
</html>
<%
'Script reads values from a Microsoft SQL database & displays them

Dim conn
Dim dbPcModel 'PC Model
Dim dbPcManufacturer 'PC Make
Dim dbPcSpeed 'Processor speed
Dim dbSN 'PC Serial Number
Dim dbRam 'Memory (MHz)
Dim dbHdd 'Disk Capacity
Dim dbCpu 'Processor type
Dim dbOs 'Operating System
Dim dbType 'PC Type (desktop/laptop)
Dim dbCost 'Cost Centre

QueryDatabase()

'
' Method: QueryDatabase
'
' Author: Iain Worlock
' Description: This subroutine retrieves the users asset record from the
database
' Date of last update: 16/08/2004
'
Sub QueryDatabase
Dim dbrs
Dim results
Dim ownerEmail

ownerEmail = "ia**********@hp.com"

' Open database query
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=asset_tracker"

Set dbrs = conn.Execute("select * from test2 where email like '" +
ownerEmail + "'")
Set results = dbrs.Fields
dbSN = results.Item("serial_number").Value
dbPcModel = results.Item("pc_model").Value
dbPcManufacturer = results.Item("manufacturer").Value
dbPcSpeed = results.Item("cpu_mhz").Value
dbRam = results.Item("ram_mb").Value
dbHdd = results.Item("hdd_gb").Value
dbCpu = results.Item("processor").Value
dbOs = results.Item("os").Value
dbType = results.Item("type").Value
dbCost = results.Item("cost_centre").Value
response.Write("serial is: " + dbSN +"<BR>")
response.Write("model is: " + dbPcModel +"<BR>")
response.Write("make is: " + dbPcManufacturer +"<BR>")
response.Write("speed is: " + CStr(dbPcSpeed) +"<BR>")
response.Write("mem is: " + CStr(dbRam) +"<BR>")
response.Write("storage is: " + CStr(dbHdd) +"<BR>")
response.Write("processor speed is: " + CStr(dbCpu) +"<BR>")
response.Write("OS is: " + dbOs +"<BR>")
response.Write("processor type is: " + dbType +"<BR>")
response.Write("cost centre is: " + dbCost +"<BR>")
End Sub
%>

MICROSOFT SQL TABLE:

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[test2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[test2]
GO

CREATE TABLE [dbo].[test2] (
[pkindex] [int] NOT NULL ,
[email] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[pc_model] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[manufacturer] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[serial_number] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cpu_mhz] [int] NULL ,
[ram_mb] [int] NULL ,
[hdd_gb] [int] NULL ,
[processor] [int] NULL ,
[os] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[type] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[cost_centre] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
DATA (CSV):

1, ia**********@hp.com, model=evo, make=compaq, serial=2345, 1800, 384, 40,
9999, os=win, type=p3, cost=null

OUTPUT:

<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
</head>
<body>

serial is: serial=2345<BR>
model is: <BR>
make is: <BR>
speed is: 1800<BR>
mem is: 384<BR>
storage is: 40<BR>
processor speed is: 9999<BR>
OS is: os=win<BR>
processor type is: type=p3<BR>
cost centre is: cost=null<BR>
</body>
</html>

================================================== ===

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James Allan | last post by:
Hello -- I'm trying to get SQL Server 2000 on a Windows 2000 Server to be able to query an Active Directory. We've got two domain servers one Win2000 and one Win2003. However, I'm having...
0
by: Michael Fork | last post by:
Note: I pasted the code the attachments as plain text after the message (I wasn't able to post it with an attachment...) Attached are the XSL and XML files that I am having problems with. I am...
1
by: Eric | last post by:
I am trying to figure out a good way to implement a XSLT transformation. Basically my goal is that I want to be able to ouput the following XML in a document: <chart type="pie" width="100"...
9
by: Mark | last post by:
Hi there On this page i get some errors when validating: http://www.keyone.nl/lab/beeldlijn/nl/collection.asp The problem is caused by the use of ASP in my pages. This is the code: <a...
5
by: Microsoft | last post by:
Hi, I have Visual Basic .net 2003 (Standard Edition) & SQL Server 2000 Developer Edition. When trying to create a connection in the server explorer from the .net IDE I get a number of problems;...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
2
by: starfi3ld | last post by:
I got a few errors with this script Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line...
4
by: ThePhenix | last post by:
Hi everybody, I have recently been doing a conversion for my boss for a access 2000 database (both front and backend) to a MSSQL backend. I finished the conversion today (as quite a lot of the...
0
by: Hamayun Khan | last post by:
Hi I m developing site for my client using asp.net 2.0. He asked me for URL rewriting. which I have done using Intelligencia.UrlRewriter.RewriterHttpModule rewriting module. I write the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.