I suck. Very basic question.

  • Thread starter Thread starter BethInAK
  • Start date Start date
B

BethInAK

Thank you in advance for any possible help you have to offer, before I
pull my hair out!

I am incredibly frustrated attempting to learn asp.net. Its really
pissing me off. Please help.

First, please tell me the best asp .net book to purchase for a stupid
beginner, preferably with vb instead of C. I have no idea what most of
the c code in my current book means and in trying to learn the .net
stuff at the same time, its giving me quite the cranky temper. I have
a programming background, so I have no idea why this is so difficult for
me.

Secondly,the following code gives me an error for this line
dbread=dbcomm.ExecuteReader() saying "no value given for one or more
parameters". Whats going on, please?



<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data.OleDb" %>

<script runat="server">

sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT * FROM tblorgs order by organization"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
orgs.DataSource=dbread
orgs.DataBind()
dbread.Close()
dbconn.Close()
end sub

Sub Search_click(s as object, e as eventargs)



dim dbconn,sql,dbcomm,dbread
Dim filtervalue as string = orgs.selecteditem.text

dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT tblOrgs.Organization, [CategoryID] & '.' &
[SectionNumber] AS [Section], tblSection.SectionName AS Name,
tblNeeds.NeedID AS [Need Identified], tblNeeds.AssistanceRequested AS
[Assistance Requested], tblNeeds.NoAssistanceNeeded AS [No Assistance
Needed] FROM tblSection INNER JOIN (tblOrgs INNER JOIN tblNeeds ON
tblOrgs.OrgID = tblNeeds.OrgID) ON tblSection.SectionID =
tblNeeds.SectionID where tblOrgs.OrgdID= " & filterValue


dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
SEARCHRESULTS.DataSource=dbread
searchresults.DataBind()
dbread.Close()
dbconn.Close()

END SUB

Sub DataList1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub

Sub orgs_SelectedIndexChanged(sender As Object, e As EventArgs)

End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASP:DropDownList id="orgs" runat="server" AutoPostBack="True"
DataValueField="orgid" datatextfield="organization"
OnSelectedIndexChanged="orgs_SelectedIndexChanged"></ASP:DropDownList>
<asp:button id="search" onclick="search_click" runat="server"
text="search for data"></asp:button>
</form>
<ASP:DataGrid id="searchresults" runat="server" Width="100%"
BackColor="white" BorderColor="black" ShowFooter="false"
CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size="8pt"
Headerstyle-BackColor="lightblue" Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold" MaintainState="false"
BorderStyle="Dotted">
<HeaderStyle font-size="10pt" backcolor="LightBlue">
</HeaderStyle>
</ASP:DataGrid>
</body>
</html>
 
ASP.NET Unleashed is a book I have ordered. It comes highly recommeneded.

Your executereader error--seems like the method expects some parameters
ie. executereader(somethinghere)--check the method syntax

I am new at .NET also--although I was pretty good at ASP.

HTH

Shane

BethInAK said:
Thank you in advance for any possible help you have to offer, before I
pull my hair out!

I am incredibly frustrated attempting to learn asp.net. Its really
pissing me off. Please help.

First, please tell me the best asp .net book to purchase for a stupid
beginner, preferably with vb instead of C. I have no idea what most of
the c code in my current book means and in trying to learn the .net
stuff at the same time, its giving me quite the cranky temper. I have
a programming background, so I have no idea why this is so difficult for
me.

Secondly,the following code gives me an error for this line
dbread=dbcomm.ExecuteReader() saying "no value given for one or more
parameters". Whats going on, please?



<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data.OleDb" %>

<script runat="server">

sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT * FROM tblorgs order by organization"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
orgs.DataSource=dbread
orgs.DataBind()
dbread.Close()
dbconn.Close()
end sub

Sub Search_click(s as object, e as eventargs)



dim dbconn,sql,dbcomm,dbread
Dim filtervalue as string = orgs.selecteditem.text

dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT tblOrgs.Organization, [CategoryID] & '.' &
[SectionNumber] AS [Section], tblSection.SectionName AS Name,
tblNeeds.NeedID AS [Need Identified], tblNeeds.AssistanceRequested AS
[Assistance Requested], tblNeeds.NoAssistanceNeeded AS [No Assistance
Needed] FROM tblSection INNER JOIN (tblOrgs INNER JOIN tblNeeds ON
tblOrgs.OrgID = tblNeeds.OrgID) ON tblSection.SectionID =
tblNeeds.SectionID where tblOrgs.OrgdID= " & filterValue


dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
SEARCHRESULTS.DataSource=dbread
searchresults.DataBind()
dbread.Close()
dbconn.Close()

END SUB

Sub DataList1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub

Sub orgs_SelectedIndexChanged(sender As Object, e As EventArgs)

End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASP:DropDownList id="orgs" runat="server" AutoPostBack="True"
DataValueField="orgid" datatextfield="organization"
OnSelectedIndexChanged="orgs_SelectedIndexChanged"></ASP:DropDownList>
<asp:button id="search" onclick="search_click" runat="server"
text="search for data"></asp:button>
</form>
<ASP:DataGrid id="searchresults" runat="server" Width="100%"
BackColor="white" BorderColor="black" ShowFooter="false"
CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size="8pt"
Headerstyle-BackColor="lightblue" Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold" MaintainState="false"
BorderStyle="Dotted">
<HeaderStyle font-size="10pt" backcolor="LightBlue">
</HeaderStyle>
</ASP:DataGrid>
</body>
</html>
 
You seem to be declaring your variables with no datatype or object type so
they are created with an Object datatype. Try using a strongly typed
declaration instead. So dbread would be OleDbReader or something like that.

And, if I recall, the ExecuteReader command shouldn't need any arguments
after you've declared the dbread variable with an OleDbReader datatype.

--
Stephajn Craig
BethInAK said:
Thank you in advance for any possible help you have to offer, before I
pull my hair out!

I am incredibly frustrated attempting to learn asp.net. Its really
pissing me off. Please help.

First, please tell me the best asp .net book to purchase for a stupid
beginner, preferably with vb instead of C. I have no idea what most of
the c code in my current book means and in trying to learn the .net
stuff at the same time, its giving me quite the cranky temper. I have
a programming background, so I have no idea why this is so difficult for
me.

Secondly,the following code gives me an error for this line
dbread=dbcomm.ExecuteReader() saying "no value given for one or more
parameters". Whats going on, please?



<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data.OleDb" %>

<script runat="server">

sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT * FROM tblorgs order by organization"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
orgs.DataSource=dbread
orgs.DataBind()
dbread.Close()
dbconn.Close()
end sub

Sub Search_click(s as object, e as eventargs)



dim dbconn,sql,dbcomm,dbread
Dim filtervalue as string = orgs.selecteditem.text

dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT tblOrgs.Organization, [CategoryID] & '.' &
[SectionNumber] AS [Section], tblSection.SectionName AS Name,
tblNeeds.NeedID AS [Need Identified], tblNeeds.AssistanceRequested AS
[Assistance Requested], tblNeeds.NoAssistanceNeeded AS [No Assistance
Needed] FROM tblSection INNER JOIN (tblOrgs INNER JOIN tblNeeds ON
tblOrgs.OrgID = tblNeeds.OrgID) ON tblSection.SectionID =
tblNeeds.SectionID where tblOrgs.OrgdID= " & filterValue


dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
SEARCHRESULTS.DataSource=dbread
searchresults.DataBind()
dbread.Close()
dbconn.Close()

END SUB

Sub DataList1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub

Sub orgs_SelectedIndexChanged(sender As Object, e As EventArgs)

End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASP:DropDownList id="orgs" runat="server" AutoPostBack="True"
DataValueField="orgid" datatextfield="organization"
OnSelectedIndexChanged="orgs_SelectedIndexChanged"></ASP:DropDownList>
<asp:button id="search" onclick="search_click" runat="server"
text="search for data"></asp:button>
</form>
<ASP:DataGrid id="searchresults" runat="server" Width="100%"
BackColor="white" BorderColor="black" ShowFooter="false"
CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size="8pt"
Headerstyle-BackColor="lightblue" Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold" MaintainState="false"
BorderStyle="Dotted">
<HeaderStyle font-size="10pt" backcolor="LightBlue">
</HeaderStyle>
</ASP:DataGrid>
</body>
</html>
 
Beth,

A very good book is ASP.Net:Tips, Tutorials, and Code by
Scott Mitchell (ISBN:0-672-32143-2). Scott is a great
author and makes things very clear. One quirk of a lot of
examples though is that they do not use a code-behind, so
when you try to run them in the regular Visual Studio
environment they fail. Download the WebMatrix tool from
www.ASP.Net and run the examples there.

Also, take a look at the website www.4guysfromrolla.com.
This is Scot Mitchell's site and it has many helpful
examples. I started out by working through his 15 part
series on the datagrid. It goes over many of the issues
you are having difficulty with.

My forehead got flat from banging my head on the table
when I started too

Good Luck

Michael



-----Original Message-----
Thank you in advance for any possible help you have to offer, before I
pull my hair out!

I am incredibly frustrated attempting to learn asp.net. Its really
pissing me off. Please help.

First, please tell me the best asp .net book to purchase for a stupid
beginner, preferably with vb instead of C. I have no idea what most of
the c code in my current book means and in trying to learn the .net
stuff at the same time, its giving me quite the cranky temper. I have
a programming background, so I have no idea why this is so difficult for
me.

Secondly,the following code gives me an error for this line
dbread=dbcomm.ExecuteReader() saying "no value given for one or more
parameters". Whats going on, please?



<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data.OleDb" %>

<script runat="server">

sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT * FROM tblorgs order by organization"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
orgs.DataSource=dbread
orgs.DataBind()
dbread.Close()
dbconn.Close()
end sub

Sub Search_click(s as object, e as eventargs)



dim dbconn,sql,dbcomm,dbread
Dim filtervalue as string = orgs.selecteditem.text

dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT tblOrgs.Organization, [CategoryID] & '.' &
[SectionNumber] AS [Section], tblSection.SectionName AS Name,
tblNeeds.NeedID AS [Need Identified],
tblNeeds.AssistanceRequested AS
[Assistance Requested], tblNeeds.NoAssistanceNeeded AS [No Assistance
Needed] FROM tblSection INNER JOIN (tblOrgs INNER JOIN tblNeeds ON
tblOrgs.OrgID = tblNeeds.OrgID) ON tblSection.SectionID =
tblNeeds.SectionID where tblOrgs.OrgdID= " & filterValue


dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
SEARCHRESULTS.DataSource=dbread
searchresults.DataBind()
dbread.Close()
dbconn.Close()

END SUB

Sub DataList1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub

Sub orgs_SelectedIndexChanged(sender As Object, e As EventArgs)

End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASP:DropDownList id="orgs" runat="server" AutoPostBack="True"
DataValueField="orgid" datatextfield="organization"
OnSelectedIndexChanged="orgs_SelectedIndexChanged"></ASP:D ropDownList>
<asp:button id="search" onclick="search_click" runat="server"
text="search for data"></asp:button>
</form>
<ASP:DataGrid id="searchresults" runat="server" Width="100%"
BackColor="white" BorderColor="black" ShowFooter="false"
CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font- Size="8pt"
Headerstyle-BackColor="lightblue" Headerstyle-Font- Size="10pt"
Headerstyle-Font-Style="bold" MaintainState="false"
BorderStyle="Dotted">
<HeaderStyle font-size="10pt" backcolor="LightBlue">
</HeaderStyle>
</ASP:DataGrid>
</body>
</html>
 
Beth,

It's not a book, but I found the tutorials on the site: www.gotdotnet.com
extremely helpful in getting started.

They are inside of the "Toolbox" menu on the left bar of the site.

Good Luck!

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
BethInAK said:
Thank you in advance for any possible help you have to offer, before I
pull my hair out!

I am incredibly frustrated attempting to learn asp.net. Its really
pissing me off. Please help.

First, please tell me the best asp .net book to purchase for a stupid
beginner, preferably with vb instead of C. I have no idea what most of
the c code in my current book means and in trying to learn the .net
stuff at the same time, its giving me quite the cranky temper. I have
a programming background, so I have no idea why this is so difficult for
me.

Secondly,the following code gives me an error for this line
dbread=dbcomm.ExecuteReader() saying "no value given for one or more
parameters". Whats going on, please?



<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data.OleDb" %>

<script runat="server">

sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT * FROM tblorgs order by organization"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
orgs.DataSource=dbread
orgs.DataBind()
dbread.Close()
dbconn.Close()
end sub

Sub Search_click(s as object, e as eventargs)



dim dbconn,sql,dbcomm,dbread
Dim filtervalue as string = orgs.selecteditem.text

dbconn=New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;data source=d:\APCA\Technical
Assistance Team\Plan Database\TA_Plans.mdb")
dbconn.Open()
sql="SELECT tblOrgs.Organization, [CategoryID] & '.' &
[SectionNumber] AS [Section], tblSection.SectionName AS Name,
tblNeeds.NeedID AS [Need Identified], tblNeeds.AssistanceRequested AS
[Assistance Requested], tblNeeds.NoAssistanceNeeded AS [No Assistance
Needed] FROM tblSection INNER JOIN (tblOrgs INNER JOIN tblNeeds ON
tblOrgs.OrgID = tblNeeds.OrgID) ON tblSection.SectionID =
tblNeeds.SectionID where tblOrgs.OrgdID= " & filterValue


dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
SEARCHRESULTS.DataSource=dbread
searchresults.DataBind()
dbread.Close()
dbconn.Close()

END SUB

Sub DataList1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub

Sub orgs_SelectedIndexChanged(sender As Object, e As EventArgs)

End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<ASP:DropDownList id="orgs" runat="server" AutoPostBack="True"
DataValueField="orgid" datatextfield="organization"
OnSelectedIndexChanged="orgs_SelectedIndexChanged"></ASP:DropDownList>
<asp:button id="search" onclick="search_click" runat="server"
text="search for data"></asp:button>
</form>
<ASP:DataGrid id="searchresults" runat="server" Width="100%"
BackColor="white" BorderColor="black" ShowFooter="false"
CellPadding="3" CellSpacing="0" Font-Name="Verdana" Font-Size="8pt"
Headerstyle-BackColor="lightblue" Headerstyle-Font-Size="10pt"
Headerstyle-Font-Style="bold" MaintainState="false"
BorderStyle="Dotted">
<HeaderStyle font-size="10pt" backcolor="LightBlue">
</HeaderStyle>
</ASP:DataGrid>
</body>
</html>
 
Beth,

A very good book is ASP.Net:Tips, Tutorials, and Code by
Scott Mitchell (ISBN:0-672-32143-2). Scott is a great
author and makes things very clear. One quirk of a lot of
examples though is that they do not use a code-behind, so
when you try to run them in the regular Visual Studio
environment they fail. Download the WebMatrix tool from
www.ASP.Net and run the examples there.

I am using webmatrix - I figured less was more when learning a new
language.

Also, take a look at the website www.4guysfromrolla.com.
This is Scot Mitchell's site and it has many helpful
examples. I started out by working through his 15 part
series on the datagrid. It goes over many of the issues
you are having difficulty with.

Thanks!!



My forehead got flat from banging my head on the table
when I started too


Glad its not just me.
 
Back
Top