469,934 Members | 1,823 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

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 2880
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Stijn Verrept | last post: by
1 post views Thread by Rick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.