Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


VB boolean to SQL bit conversion?


VB boolean to SQL bit conversion?

Author
Message
Vikka
Vikka
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 151
If a column is datatype bit in SQL database, how can I represent it in the form? If I use drop down menu with Yes and No (1/0) VB boolean datatype, how can I convert form boolean output to bit so I can submit it to SQL database?
Gift Peddie
Gift Peddie
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3452 Visits: 14456

It depends on what version of Asp.net you are using in Asp.net 2.0 it is easy because of the introduction of the Nullable <T> because it also takes boolean, it is very hard in 1.1.  Try the link below for Nullable solutions including the bool.  Hope this helps.

http://www.codeproject.com/cs/database/NullableReaders.asp

 



Kind regards,
Gift Peddie
Vikka
Vikka
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 151

Thank you GIft Peddie, I will go read now. How come you know everything?


David A. Long
David A. Long
SSChasing Mays
SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)SSChasing Mays (643 reputation)

Group: General Forum Members
Points: 643 Visits: 237

Actually the VB6 boolean is True = -1 and False = 0, so to convert the myVB6Bool variable to SQL bit would be Abs(myVB6bool), which returns 1 or 0 instead of -1 or 0.

Andy





Gift Peddie
Gift Peddie
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3452 Visits: 14456

You are talking about obsolete stuff we are talking about VB.NET which in 1.1 was two valued so getting database Bool which is Bit is not easy but we asked for and got the Nullable<T> in the whole .NET framework in 2.0 to use with three valued database types.

 

 



Kind regards,
Gift Peddie
Vikka
Vikka
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 151

This is all too smart for me, like a rocket science. I am still a script kitty.

Problem is: there is bit field in the database allowOrders (this is not my field, I would make it bolean instead of bit). I need to control this field from the interface where I have  a drop down menu allow_orders with values 1 and 0. I get the output from this menu and put it into the bolean variable allowOrders and try to update allowOrders field in the database with the value of this variable. And nothing happens. I assume it's because of the datatype discrepancy. My question was how I can convert that VB.NEt bolean variable into bit type so I can update bit field in SQL database?

 

 


Gift Peddie
Gift Peddie
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3452 Visits: 14456

Sorry in VB.NET 2.0 here is a visual way to do it with ObjectDatasource, let me know how it goes.  Hope this helps.

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/objectdatasource.aspx

 



Kind regards,
Gift Peddie
Vikka
Vikka
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 151

Peddie,

I just did a horrible thing and I don't know how to fix it. In IIS I was trying to add a new web app to application pool and I screwed everything. There was existing application that used permissions. New application also had users with permissions. When I started to add a website to default website, new application swallowed existing one, they both got into the same directory in IIS though phisically they are in the different ones. Then my colleque said "delete everything" from that web site directory in IIS and I did.

Now i need to restore everything. Fist time I did it, it took me several days and I don't remember how I did it, somebody told me how to add application to web site and to application pool in IIS. Now I am screwed again.

 


Gift Peddie
Gift Peddie
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3452 Visits: 14456

Check your recycle bin if you can undelete the files there are undelete utilities test drive some and if you have source control the Admin can rollback your changes.  Another place to check is the folders you created for the projects see if you can move it to VS, I don't know about regular VS because we use fancy Team Suite, it creates more work for you but you cannot make such mistakes with it.  Keep me posted.



Kind regards,
Gift Peddie
Vikka
Vikka
SSC-Enthusiastic
SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)SSC-Enthusiastic (159 reputation)

Group: General Forum Members
Points: 159 Visits: 151
We don't have air conditioner for the whole day at work, high temp and no oxigen. It probably affected my brain. Thing is that when I added that ap, it added itself instead of Default web site and after I deleted it, default web site is gone. Now probably I have to re-install IIS since default web site folder should be always there. There is no source control. They just gave me server at work, I asked "who's server admin?" - "You are". "Who's db admin?" "You are". But I'm also a developer and it's hard to know and remember everything plus they want you to do support for other systems and impossible just to concentrate on one thing. I will go check the recycler bin though it will not help.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search