Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

VB boolean to SQL bit conversion? Expand / Collapse
Author
Message
Posted Friday, March 30, 2007 7:27 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 6, 2013 10:47 AM
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?
Post #355172
Posted Sunday, April 1, 2007 9:09 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 2:32 PM
Points: 3,428, Visits: 14,439

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
Post #355238
Posted Sunday, April 1, 2007 6:24 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 6, 2013 10:47 AM
Points: 159, Visits: 151

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

Post #355264
Posted Monday, April 2, 2007 2:18 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Thursday, July 3, 2014 2:36 PM
Points: 631, Visits: 236

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




Post #355289
Posted Monday, April 2, 2007 5:56 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 2:32 PM
Points: 3,428, Visits: 14,439

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
Post #355311
Posted Monday, April 2, 2007 9:42 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 6, 2013 10:47 AM
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?

 

 

Post #355393
Posted Monday, April 2, 2007 10:54 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 2:32 PM
Points: 3,428, Visits: 14,439

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
Post #355413
Posted Tuesday, April 3, 2007 3:27 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 6, 2013 10:47 AM
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.

 

Post #355767
Posted Tuesday, April 3, 2007 3:52 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 2:32 PM
Points: 3,428, Visits: 14,439

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
Post #355771
Posted Tuesday, April 3, 2007 4:12 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 6, 2013 10:47 AM
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.
Post #355773
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse