Bool

  • Thread starter Thread starter rcoco
  • Start date Start date
bool x = (bool) ( expression );

However you shouldn't have to as the expression will evaluate to true or
false, so;



bool x = expression

is usually enough. If you want to turn "True" or "False" into a bool;



bool x = bool.Parse(boolString)
 
bool x = (bool) ( expression );

However you shouldn't have to as the expression will evaluate to true or
false, so;

bool x = expression

is usually enough. If you want to turn "True" or "False" into a bool;

bool x = bool.Parse(boolString)






- Show quoted text -

If you have, in VB:
Dim x As Boolean
then, in C#:
bool x;
You can default by:
bool x = true;

Keep in mind, C# is case-sensitive.
 
Thanks,
I have Changed I've seen that I can actually use Set Up Windows
Authentication but When I insert data I get an error

Cannot insert the value NULL into column 'Name', table
'IS_dashboard.dbo.DashBoard'; column does not allow nulls. INSERT
fails. The statement has been terminated.
What could be the problem?
 
Thanks,
I have Changed I've seen that I can actually use Set Up Windows
Authentication but When I insert data I get an error

Cannot insert the value NULL into column 'Name', table
'IS_dashboard.dbo.DashBoard'; column does not allow nulls. INSERT
fails. The statement has been terminated.
What could be the problem?


It couldn't be very more obvious...

You're trying to insert the value NULL into the column "Name".

As the error says, the column does not allow nulls.

So don't insert NULL into the column "Name"..

As in, specify a value for Name...
 
Thanks,
The field name is supposed to get the name of the login computer so
it's not supposed to remain null. I got this example, and that's what
I'm using.This is the web.Config file:

<authentication mode="Windows">
...
</authentication>

<authorization>
<deny users="?" />
</authorization>

Got it on this website:http://www.asp101.com/articles/cynthia/authentication/default.asp
Thanks

web.config doesn't have anything to do with the error you have
posted. As one of the previous posters said,
pass a value to the column "Name". Probably not going to get alot of
help unless you show us your code.
 
Yes, sorry about my previous post dealing with boolean values. The concept is
the same. You may *think* that because your windows authentication setup is
there that the login computer will be shown, but the fact of the matter is
that your database says "NOPE". A little common sense will solve your
problem. You could even create a default value of an empty string ( "") for
the Name column, just so that you don't get any errors until you get your
programmatic act together!
peter
 
Thanks,
How could I do this. I want when the user logs In His name is shown in
the column name automatically how could I do it?
Thanks
 
If you have Windows Authentication set up in IIS for your site (in the
Security Tab) and you specify Windows Authentication in your web.config, you
should be getting
the logged on user. Here is sample code to test this:

Response.Write(Page.User.Identity.Name);
// that should output the domain\name of the logged in user.
Peter
 
Thanks Peter,
Can I ask one more question? Do I have to create a Login Page for
Windows Authentication?
Thanks
 
No. The browser transmits the login credentials that you logged in with when
you started your computer, in response to the challenge issued by the site.
Peter
 
Thanks Peter,
When I created a new webform and on the PageLoad wrote this code:
Response.Write(Page.User.Identity.Name), it actually brought the
UserName but When try it on the form with datagrid can't get the
Username in a particular column how can I solve this?
Thanks.
 
Back
Top