473,511 Members | 15,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BC30456: 'HasRows' is not a member of 'System.Data.SqlClient.SqlDataReader'.



PLEASE HELP!! I am so far behind....and it doesn't help that I am
learning all this stuff. I am using .net framework 1.0 from WebMatrix.
These parameters get me all confused...someone please help! Thanks in
advance for the assistance.

Line 18: MyConn.Open()
Line 19:
objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)
Line 20: if objDR.HasRows then
Line 21: blHasRows="True"
Line 22: else

<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SQLClient" %>
<script runat="server">

Dim blHasRows as Boolean
Sub doInsert(Source as Object, E as EventArgs)
Dim strConn as string =
"server=abcd;database:cds;trusted_connection=t rue"
Dim MySQL as string = "Select supplier_cd, inv_no, inv_date from
view_cds_all where supplier_cd=@supcd,inv_no=@invnum, inv_date=@invdat"
Dim MyConn as New SQLConnection(strConn)
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
With Cmd.Parameters
.Add(New SQLParameter("@supcd", frmsupcd.text))
.Add(New SQLParameter("@invnum", frminvnum.text))
.Add(New SQLParameter("@invdat", frminvdat.text))
End With
MyConn.Open()
objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)
if objDR.HasRows then
blHasRows="True"
else
blHasRows="False"
End If
MyConn.Close()
MySQL = "Insert into ap_vendors.dbo.tbl_ap_web_ce_inv_terms
(supcd, invnum, invdat) Values (@supcd, @invnum, @invdat)"
Dim Cmd2 as New SQLCommand(MySQL, MyConn)
With Cmd2.Parameters
.Add(New SQLParameter("@supcd", frmsupcd.text))
.Add(New SQLParameter("@invnum", frminvnum.text))
.Add(New SQLParameter("@invdat", frminvdat.text))
End With
if blHasRows="False" then
MyConn.Open()
cmd2.ExecuteNonQuery()
lblResults.text="Your information has been received!"
MyConn.Close
seeRecords()
else
lblResults.text="Sorry, that information is already in
the database"
End If
End Sub

Sub Page_Load(Source as Object, E as EventArgs)

End Sub

Sub seeRecords()
Dim strConn as string = "server=abcd;database=ap_vendors"
Dim MySQL as string = "Select * from tbl_ap_web_ce_inv_terms order
by splr_cd"
Dim MyConn as New SQLConnection(strConn)
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
With Cmd.Parameters
.Add(New SQLParameter("@supcd", frmsupcd.text))
.Add(New SQLParameter("@invnum", frminvnum.text))
.Add(New SQLParameter("@invdat", frminvdat.text))
End With
MyConn.Open()
objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)
MyDataGrid.DataSource=objDR
MyDataGrid.DataBind
MyConn.Close()
End Sub

</script>
<html>
<head>
<title>Checking Data before Inserting New Data</title>
<meta content="ASP Express 3.2" name="GENERATOR" />
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<table>
<tbody>
<tr>
<td align="right">
Title</td>
<td>
<asp:textbox id="frmsupcd" Runat="server"
Text="Supplier Code"></asp:textbox>
</td>
</tr>
<tr>
<td align="right">
Link</td>
<td>
<asp:textbox id="frminvnum" Runat="server"
Text="invoice number"></asp:textbox>
</td>
</tr>
<tr>
<td align="right">
Description</td>
<td>
<asp:textbox id="frminvdat"
Runat="server"></asp:textbox>
</td>
</tr>
<tr>
<td align="right">
<asp:button id="button1" onclick="doInsert"
Runat="server" Text="Submit"></asp:button>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<asp:Label id="lblResults" runat="server"
font-bold="True"></asp:Label>
<asp:Datagrid id="MyDataGrid" Runat="server"
BorderColor="Black" Font-Size="8" Font-Name="Arial" BackColor="#E7EFFF"
Headerstyle-Font-Size="8" Headerstyle-Font-Name="Arial"
Headerstyle-BackColor="#BDCFE7" cellspacing="0" cellpadding="0"
GridLines="Both"></asp:Datagrid>
</div>
</form>
</body>
</html>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 3049
Hi,

check what version of the framework you're running, in the .NET Framework
reference I saw the following sentence:

Note: This namespace, class, or member is supported only in version 1.1 of
the .NET Framework.

Hope this helps
Cheers
Cristian

"TN Bella" <ti********@nav-international.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...


PLEASE HELP!! I am so far behind....and it doesn't help that I am
learning all this stuff. I am using .net framework 1.0 from WebMatrix.
These parameters get me all confused...someone please help! Thanks in
advance for the assistance.

Line 18: MyConn.Open()
Line 19:
objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)
Line 20: if objDR.HasRows then
Line 21: blHasRows="True"
Line 22: else

<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SQLClient" %>
<script runat="server">

Dim blHasRows as Boolean
Sub doInsert(Source as Object, E as EventArgs)
Dim strConn as string =
"server=abcd;database:cds;trusted_connection=t rue"
Dim MySQL as string = "Select supplier_cd, inv_no, inv_date from
view_cds_all where supplier_cd=@supcd,inv_no=@invnum, inv_date=@invdat"
Dim MyConn as New SQLConnection(strConn)
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
With Cmd.Parameters
.Add(New SQLParameter("@supcd", frmsupcd.text))
.Add(New SQLParameter("@invnum", frminvnum.text))
.Add(New SQLParameter("@invdat", frminvdat.text))
End With
MyConn.Open()
objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)
if objDR.HasRows then
blHasRows="True"
else
blHasRows="False"
End If
MyConn.Close()
MySQL = "Insert into ap_vendors.dbo.tbl_ap_web_ce_inv_terms
(supcd, invnum, invdat) Values (@supcd, @invnum, @invdat)"
Dim Cmd2 as New SQLCommand(MySQL, MyConn)
With Cmd2.Parameters
.Add(New SQLParameter("@supcd", frmsupcd.text))
.Add(New SQLParameter("@invnum", frminvnum.text))
.Add(New SQLParameter("@invdat", frminvdat.text))
End With
if blHasRows="False" then
MyConn.Open()
cmd2.ExecuteNonQuery()
lblResults.text="Your information has been received!"
MyConn.Close
seeRecords()
else
lblResults.text="Sorry, that information is already in
the database"
End If
End Sub

Sub Page_Load(Source as Object, E as EventArgs)

End Sub

Sub seeRecords()
Dim strConn as string = "server=abcd;database=ap_vendors"
Dim MySQL as string = "Select * from tbl_ap_web_ce_inv_terms order
by splr_cd"
Dim MyConn as New SQLConnection(strConn)
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
With Cmd.Parameters
.Add(New SQLParameter("@supcd", frmsupcd.text))
.Add(New SQLParameter("@invnum", frminvnum.text))
.Add(New SQLParameter("@invdat", frminvdat.text))
End With
MyConn.Open()
objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)
MyDataGrid.DataSource=objDR
MyDataGrid.DataBind
MyConn.Close()
End Sub

</script>
<html>
<head>
<title>Checking Data before Inserting New Data</title>
<meta content="ASP Express 3.2" name="GENERATOR" />
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<table>
<tbody>
<tr>
<td align="right">
Title</td>
<td>
<asp:textbox id="frmsupcd" Runat="server"
Text="Supplier Code"></asp:textbox>
</td>
</tr>
<tr>
<td align="right">
Link</td>
<td>
<asp:textbox id="frminvnum" Runat="server"
Text="invoice number"></asp:textbox>
</td>
</tr>
<tr>
<td align="right">
Description</td>
<td>
<asp:textbox id="frminvdat"
Runat="server"></asp:textbox>
</td>
</tr>
<tr>
<td align="right">
<asp:button id="button1" onclick="doInsert"
Runat="server" Text="Submit"></asp:button>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<asp:Label id="lblResults" runat="server"
font-bold="True"></asp:Label>
<asp:Datagrid id="MyDataGrid" Runat="server"
BorderColor="Black" Font-Size="8" Font-Name="Arial" BackColor="#E7EFFF"
Headerstyle-Font-Size="8" Headerstyle-Font-Name="Arial"
Headerstyle-BackColor="#BDCFE7" cellspacing="0" cellpadding="0"
GridLines="Both"></asp:Datagrid>
</div>
</form>
</body>
</html>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

Thanks! After this project I am updating my .net framework!! argh!
Thanks again...I have to wait until Monday to see if I can fix the
project.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

0
2501
by: James Hokes | last post by:
Hi All, We're using the 1.1. Framework against SQL Server 2000, and are having a strange issue where we don't get errors back from the stored procedure, i.e. the exception never gets thrown. ...
1
4824
by: charliewest | last post by:
Is there a .Net Compact Framework equivalent in the system.data.sqlserverce namespace of the .Net Framework system.data.sqlclient DataReader object's "Has.Rows" method? For example: ...
17
9649
by: Rodusa | last post by:
I am getting this exception error which is driving me nuts. System.NullReferenceException - Object reference not set to an instance of an object If I comment this line, I don't get any errors:...
2
1697
by: Stijn Verrept | last post by:
I am having the same problem as the person in this thread mentions: http://groups.google.be/groups?q=asp+net+empty+datareader+hasrows&hl=nl&...
2
4560
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
2
2723
by: sxiao | last post by:
Hi, there I got a NullReferenceException when there are more than one users trying to open the same page at the same time. The senerio is: Two users logged into the web application using the...
1
2352
by: Rick | last post by:
I have found the HasRows member of the OleDbConnection. This is very nice to tell me if I have any data coming but what if I want to see how many rows of data I have. Is there a similar member to...
5
2495
by: mmatchyn | last post by:
I have been trying to create a class similar to SqlClient but one that prints sql statements instead of running them on the database. This way when I want to go into test mode I comment out the...
3
24222
by: weird0 | last post by:
This is the exception that I get when i create a webserivce obj and call. The error comes on the webmethod call, when it opens a connection to the db. How do I fix it? What is the solution to...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
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
7349
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
7417
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
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.