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

T

TN Bella

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.CommandBehavior.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=true"
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.CommandBehavior.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.CommandBehavior.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!
 
C

Cristian Suazo

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
 
T

TN Bella

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top