Showing posts with label trouble. Show all posts
Showing posts with label trouble. Show all posts

Thursday, March 29, 2012

newbie: how to compare bit field from sql table to oledbdatareader?

Hi, I made a bit field off my sql table to represent true/false.
I'm having trouble to use compare the value off that table using OleDbDataReader, please help correct my code:
string connectionString = "(connect goes here)";
string sql = "SELECT isActived FROM List WHERE ID=@dotnet.itags.org.ID";
SqlConnection conn = new SqlConnection(connectionString);
SqlDataReader reader = null;
conn.Open();
SqlCommand cmd = new SqlCommand(sql,conn);
cmd.Parameters.Add("@dotnet.itags.org.license", "(my id number goes here)");
reader = cmd.ExecuteReader();
(something wrong with this code:) bool temp = reader["isActived"];
(or this:) if (
reader["isActived"] == true)
reader.Close();
conn.Close();
TIA

After a call to ExecuteRead, the reader is positioned before the first row. You must call reader.Read() to position the reader on a row before you attempt to access any data.


If you only get one value back, you may try this:
bool temp = cmd.ExecuteScalar();


thanks DMW, Jimmy, looks like ExecuteScalar would help me save a couple lines of code :)

Saturday, March 24, 2012

newbie: trouble with asp:HyperLink

hey
asp.net 2.0
I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
something like www.helloworld.com, and click on the link during runtime,
then the link don't navigate to this page. Instead it navigate to
http://localhost:1794/Test/Controls/www.helloworld.com
http://localhost:1794/Test/Controls/ is the folder in which I've placed the
usercontrol using this hyperlink
This is the markup of my HyperLink
<asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />
Any suggestions?
JeffJeff,
You have to preface an external URL with http://. The control won't do
it for you as it can't tell if you're looking to browser to a local page or
want to browse to an external site.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...
> hey
> asp.net 2.0
> I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
> something like www.helloworld.com, and click on the link during runtime,
> then the link don't navigate to this page. Instead it navigate to
> http://localhost:1794/Test/Controls/www.helloworld.com
> http://localhost:1794/Test/Controls/ is the folder in which I've placed
> the usercontrol using this hyperlink
> This is the markup of my HyperLink
> <asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
> Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />
> Any suggestions?
> Jeff
>
>
>
okay, thanks
"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:uTpSbPu$GHA.3928@.TK2MSFTNGP03.phx.gbl...
>I suggest you set the hyperlink's NavigateURL to this:
> http://www.helloworld.com
> That way it doesn't think its a relative URL since you seem to be linking
> to an external site.
> --
> I hope this helps,
> Steve C. Orr
> MCSD, MVP, CSM
> http://SteveOrr.net
>
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...
>
I suggest you set the hyperlink's NavigateURL to this:
http://www.helloworld.com
That way it doesn't think its a relative URL since you seem to be linking to
an external site.
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...
> hey
> asp.net 2.0
> I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
> something like www.helloworld.com, and click on the link during runtime,
> then the link don't navigate to this page. Instead it navigate to
> http://localhost:1794/Test/Controls/www.helloworld.com
> http://localhost:1794/Test/Controls/ is the folder in which I've placed
> the usercontrol using this hyperlink
> This is the markup of my HyperLink
> <asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
> Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />
> Any suggestions?
> Jeff
>
>
>
yes, it can tell if you're looking to browser to a local page or
want to browse to an external site.
You are telling you want to browse to a local page

newbie: trouble with asp:HyperLink

hey

asp.net 2.0

I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
something like www.helloworld.com, and click on the link during runtime,
then the link don't navigate to this page. Instead it navigate to
http://localhost:1794/Test/Controls/www.helloworld.com
http://localhost:1794/Test/Controls/ is the folder in which I've placed the
usercontrol using this hyperlink

This is the markup of my HyperLink
<asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />

Any suggestions?

JeffJeff,
You have to preface an external URL with http://. The control won't do
it for you as it can't tell if you're looking to browser to a local page or
want to browse to an external site.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
something like www.helloworld.com, and click on the link during runtime,
then the link don't navigate to this page. Instead it navigate to
http://localhost:1794/Test/Controls/www.helloworld.com
>
http://localhost:1794/Test/Controls/ is the folder in which I've placed
the usercontrol using this hyperlink
>
This is the markup of my HyperLink
<asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />
>
Any suggestions?
>
Jeff
>
>
>
>
>


I suggest you set the hyperlink's NavigateURL to this:
http://www.helloworld.com
That way it doesn't think its a relative URL since you seem to be linking to
an external site.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
something like www.helloworld.com, and click on the link during runtime,
then the link don't navigate to this page. Instead it navigate to
http://localhost:1794/Test/Controls/www.helloworld.com
>
http://localhost:1794/Test/Controls/ is the folder in which I've placed
the usercontrol using this hyperlink
>
This is the markup of my HyperLink
<asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />
>
Any suggestions?
>
Jeff
>
>
>
>
>


okay, thanks

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.netwrote in message
news:uTpSbPu$GHA.3928@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>I suggest you set the hyperlink's NavigateURL to this:
http://www.helloworld.com
>
That way it doesn't think its a relative URL since you seem to be linking
to an external site.
>
--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
>
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:etohk8t$GHA.4604@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>hey
>>
>asp.net 2.0
>>
>I have a asp:HyperLink on a usercontrol. If I set it's NavigateUrl to
>something like www.helloworld.com, and click on the link during runtime,
>then the link don't navigate to this page. Instead it navigate to
>http://localhost:1794/Test/Controls/www.helloworld.com
>>
>http://localhost:1794/Test/Controls/ is the folder in which I've placed
>the usercontrol using this hyperlink
>>
>This is the markup of my HyperLink
><asp:HyperLink ID="hlCompany" runat="server" CssClass="label"
>Target="_blank" Width="175px">[hlCompany]</asp:HyperLink><br />
>>
>Any suggestions?
>>
>Jeff
>>
>>
>>
>>
>>


>
>


yes, it can tell if you're looking to browser to a local page or
want to browse to an external site.

You are telling you want to browse to a local page

Newbie: Trouble w/ ViewState

I would greatly appreciate any assistance any one could give me. I have an
ASP.NET application that contains two frames and several popup windows for
editing information. One of the frames contains a treeview with a long list
of clients with several node underneath each client for different tasks. If
I change some information in the other frame or one of the popup windows tha
t
directly reflects on the information in my treeview, how can I reload or
postback the page my treeview is on and still maintain the view state of the
control? I know the view state is not maintained unless the postback comes
from that page, but is there any way I can capture the treeview's view state
and use it from another page? Is there something similar to view state I ca
n
use in its place?
Chrisdsmith66,
If you have a problem with the viewstate you can always save it away in the
session.
Arne.
"clsmith66" wrote:

> I would greatly appreciate any assistance any one could give me. I have a
n
> ASP.NET application that contains two frames and several popup windows for
> editing information. One of the frames contains a treeview with a long li
st
> of clients with several node underneath each client for different tasks.
If
> I change some information in the other frame or one of the popup windows t
hat
> directly reflects on the information in my treeview, how can I reload or
> postback the page my treeview is on and still maintain the view state of t
he
> control? I know the view state is not maintained unless the postback come
s
> from that page, but is there any way I can capture the treeview's view sta
te
> and use it from another page? Is there something similar to view state I
can
> use in its place?
> Chris

Newbie: Trouble w/ ViewState

I would greatly appreciate any assistance any one could give me. I have an
ASP.NET application that contains two frames and several popup windows for
editing information. One of the frames contains a treeview with a long list
of clients with several node underneath each client for different tasks. If
I change some information in the other frame or one of the popup windows that
directly reflects on the information in my treeview, how can I reload or
postback the page my treeview is on and still maintain the view state of the
control? I know the view state is not maintained unless the postback comes
from that page, but is there any way I can capture the treeview's view state
and use it from another page? Is there something similar to view state I can
use in its place?

Chrisdsmith66,
If you have a problem with the viewstate you can always save it away in the
session.
Arne.

"clsmith66" wrote:

> I would greatly appreciate any assistance any one could give me. I have an
> ASP.NET application that contains two frames and several popup windows for
> editing information. One of the frames contains a treeview with a long list
> of clients with several node underneath each client for different tasks. If
> I change some information in the other frame or one of the popup windows that
> directly reflects on the information in my treeview, how can I reload or
> postback the page my treeview is on and still maintain the view state of the
> control? I know the view state is not maintained unless the postback comes
> from that page, but is there any way I can capture the treeview's view state
> and use it from another page? Is there something similar to view state I can
> use in its place?
> Chris