364,033 Members | 4721 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

OleDBCommand and Repeater

=?Utf-8?B?bXVzb3NkZXY=?=
P: n/a
=?Utf-8?B?bXVzb3NkZXY=?=
Hi,

I'm trying to fill my Repeater control with the contents of a query
performed on an OleDB connected database. I keep getting the error...

"No value given for one or more required parameters." - but I can't work out
what parameters where. Can someone help?

<html>...

<asp:Repeater ID="rptLinks" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "site_url") %>
</ItemTemplate>
</asp:Repeater>

c#...

OleDbConnection dbConn = new
OleDbConnection(ConfigurationSettings.AppSettings. Get("System_ConnectionString"));
dbConn.Open();
OleDbCommand siteCmd = new OleDbCommand("SELECT site_name, site_url FROM
sites WHERE band_id = " + bandid, dbConn);
OleDbDataReader siteDR = siteCmd.ExecuteReader();
rptLinks.DataSource = siteDR;
rptLinks.DataBind();
dbConn.Close();

Thanks for any help!
Jan 26 '08 #1
Share this Question
Share on Google+
5 Replies


Mark Rae [MVP]
P: n/a
Mark Rae [MVP]
"musosdev" <musoswire@community.nospamwrote in message
news:BD57ED95-2CDA-4516-8365-A70D25D83923@microsoft.com...
OleDbCommand siteCmd = new OleDbCommand("SELECT site_name, site_url FROM
sites WHERE band_id = " + bandid, dbConn);
Put a breakpoint on the above line and inspect the value of bandid


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 27 '08 #2

=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
P: n/a
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
You need to invest in taking your programming expertise to the next level by
starting to use parameterized queries instead of concatenating textual Sql
statements.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com


"musosdev" wrote:
Hi,
>
I'm trying to fill my Repeater control with the contents of a query
performed on an OleDB connected database. I keep getting the error...
>
"No value given for one or more required parameters." - but I can't work out
what parameters where. Can someone help?
>
<html>...
>
<asp:Repeater ID="rptLinks" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "site_url") %>
</ItemTemplate>
</asp:Repeater>
>
c#...
>
OleDbConnection dbConn = new
OleDbConnection(ConfigurationSettings.AppSettings. Get("System_ConnectionString"));
dbConn.Open();
OleDbCommand siteCmd = new OleDbCommand("SELECT site_name, site_url FROM
sites WHERE band_id = " + bandid, dbConn);
OleDbDataReader siteDR = siteCmd.ExecuteReader();
rptLinks.DataSource = siteDR;
rptLinks.DataBind();
dbConn.Close();
>
Thanks for any help!
Jan 27 '08 #3

=?Utf-8?B?bXVzb3NkZXY=?=
P: n/a
=?Utf-8?B?bXVzb3NkZXY=?=
Thanks Mark


"Mark Rae [MVP]" wrote:
"musosdev" <musoswire@community.nospamwrote in message
news:BD57ED95-2CDA-4516-8365-A70D25D83923@microsoft.com...
>
OleDbCommand siteCmd = new OleDbCommand("SELECT site_name, site_url FROM
sites WHERE band_id = " + bandid, dbConn);
>
Put a breakpoint on the above line and inspect the value of bandid
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
>
>
Jan 27 '08 #4

=?Utf-8?B?bXVzb3NkZXY=?=
P: n/a
=?Utf-8?B?bXVzb3NkZXY=?=
Peter,

Fair enough. What are the advantages to doing it this way, as opposed to the
way I'm doing it currently? Could you point me at a descent tutorial?

Also, would I not be better switching to linq?!

Thanks,


Dan

"Peter Bromberg [C# MVP]" wrote:
You need to invest in taking your programming expertise to the next level by
starting to use parameterized queries instead of concatenating textual Sql
statements.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
>
>
"musosdev" wrote:
>
Hi,

I'm trying to fill my Repeater control with the contents of a query
performed on an OleDB connected database. I keep getting the error...

"No value given for one or more required parameters." - but I can't work out
what parameters where. Can someone help?

<html>...

<asp:Repeater ID="rptLinks" runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "site_url") %>
</ItemTemplate>
</asp:Repeater>

c#...

OleDbConnection dbConn = new
OleDbConnection(ConfigurationSettings.AppSettings. Get("System_ConnectionString"));
dbConn.Open();
OleDbCommand siteCmd = new OleDbCommand("SELECT site_name, site_url FROM
sites WHERE band_id = " + bandid, dbConn);
OleDbDataReader siteDR = siteCmd.ExecuteReader();
rptLinks.DataSource = siteDR;
rptLinks.DataBind();
dbConn.Close();

Thanks for any help!
Jan 27 '08 #5

Mark Rae [MVP]
P: n/a
Mark Rae [MVP]
"musosdev" <musoswire@community.nospamwrote in message
news:945F3B8A-B29A-45B9-970B-4C3E11D78A8C@microsoft.com...
What are the advantages to doing it this way, as opposed to the way
I'm doing it currently?
Do a Google search for "SQL injection"
Also, would I not be better switching to linq?!
Not for simply querying a database, IMO...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 27 '08 #6

Post your reply

Help answer this question



Didn't find the answer to your ASP.NET question?

You can also browse similar questions: ASP.NET