Bit data type

I have in my Sql Server database a field set to data type = Bit

When I read the value, which is set to 1 in the database, it comes back -1.
I changed the datatype in the database to int and it read it as 1.
Why is that?
Zath
0
Zath
3/13/2005 10:06:08 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

3 Replies
662 Views

Similar Articles

[PageSpeed] 32

Can you show us the code where you are reading the value?

Terri

Terri Morton
Engagement Manager, Neudesic

How to ask a question

0
tmorton
3/14/2005 1:11:30 AM

Dim DSopt As New DataSet
Dim iOpt As Int16 'Also tried integer here with same results
sql = "Select * from " _
& "tblAnyTable Where " _
& "fldEmail = '" & sEmail_
& "'"
DBCommand = New SqlCommand(sql, conn)
Dim SDA As SqlDataAdapter = New SqlDataAdapter
SDA.SelectCommand = DBCommand
SDA.Fill(DSopt, "tblAnyTable ")
iOpt = DSopt.Tables("tblAnyTable "). _
Rows(0).Item("fldOptIn")

Like I said, the bit data type reads a -1 when it's 1 and the int datatype reads 1.

Zath
0
Zath
3/14/2005 10:54:12 PM
I am not too checked out on the bit datatype but I believe you need to use a System.Boolean.

Terri
Terri Morton
Engagement Manager, Neudesic

How to ask a question

0
tmorton
3/15/2005 1:13:08 AM
Reply:

Similar Artilces:

sql bit data type
Hi why is it when i get value from a datareader field which is a bit data type in database is returning true/false instead of 0/1 which are actual column values. Thank you ::why is it Becvause it was programmed like this. Documented behavior.Thomas TomiczekPowerNodes ApS(Microsoft MVP C#/.NET)---Building a Website? Try the PowerNodes CMS - http://www.powernodes.com/...

SQL Server Money and .NET Data Type
I'm hoping this is the right forum. Retrieving a Money data-type from SQL Server converts to Double in .NET. But there are rounding problems, I only want 2 decimal points and sometimes rounding will round up the nearest whole integer value. What is the best data type to use for Money where accuracy is critical (financial-number-crunching)? Thanks, Shawn Use the .NET Currency type and not double. System.DecimalThanks,Teemu KeiskiFinland, EU...

Difference between var type of .NET 3.5 and object Data Type in .NET 2.0?
Hi All,With .NET 3.5 a new feature is introduced of defining Anonymous Type.You can achieve this with keyword "var".We can achieve the same functionality in .NET 2.0 with object type.What is the difference between var type of .NET 3.5 and object Data Type in .NET 2.0?Virendra (MCTS)My Site, Blog virendra1983:With .NET 3.5 a new feature is introduced of defining Anonymous Type. var types are actually strongly typed in design time. What happens in the IDE infers the type of the object based on its initialisation so you get strong typing and intellisensee.g.var i = 9...

ADO.NET SQL-Server Text data type
Hi, dear I need to get the full text of a text datatype collumn of a sql-server table. I tried the example of this link (http://www.kbalertz.com/Feedback_317034.aspx) and change getbytes to getchars and I didn't get the full text. What's wrong? How can I get the full text? Thank you very much. Obede Brazil...

sql data type "text" is what in .net?
What is the equivalent data type in .net for the sql data type "text"? I can pull varchars from the db as strings, but not this field with the type text. I get the error System.IndexOutOfRangeException: Description But if I change the type in the db, everything works. But, this field needs to be longer than a varchar. The line the error is on: _Description = Convert.ToString(dr(DESCRIPTION_FIELDNAME)) I tried using other types or not converting, no luck. This article has this to say about getting blobs: "The main difference is that in ADO.NET, you ne...

PB11 Sql Native Client and Bit data type problem
PB 11 seems to treat bits differently then older versions. -1 and 0 instead of 1 and 0. Anyone else seeing this problem? Any work arounds? Spidey; That sounds like a "bug". I just tried that with SS2005 and PB 11.1 and I get the same thing! :-( Testing with SA 10 and ASE 15 - I get +1 / 0. So it must be an SNC quirk -- Regards ... Chris http://chrispollach.pbdjmagazine.com ,\|/, (0 0) -(_)- "Spidey" <brentham@mts.net> wrote in message news:d6b2d7e8-32de-443b-a3cd-e4e8cd2ad099@o6g2000hsd.googlegroups.com... > PB 11 seems to treat...

Cannot find answer: Boolean data type in MS SQL DB (bit NOT working)
I'm trying to create a database inside of VS2008. 3 columns (test table because I don't want to ruin and data in my regular table). [] = do not allow null id-------------------int--------------[] name------------varchar(50)---------------[] check----------bit-----------------[] Save the table > Input 1 into id, Me into name, and a 0 or 1 (or t or T) into check column, and I get The changed value in this cell was not recognized as valid. .NET Framework Data Type Boolean: Error Message: String was not recognized as a valid Boolean. This is driving me nuts. I've ...

convert an sql datetime column to .net datetime data type in front end...?
I have a field (ldate) in a table that typically displays data in the following format:2007-11-12 20:30:47.000In the front end I want the time and the date separately. But as I try to cast it to a datetime object it is giving me a System.NullReferenceException. What I tried to do was just this: Protected Sub gvTopics_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvTopics.RowDataBound Dim img As Image = gvTopics.FindControl("imgIcon") Dim lbDate, lbTime As Label lbDate = gvTopics.FindControl(...

How to write to Data to SQL Server XML data type
 Hello, I have worked with SQL Server 2000 but now we have a requirement where I need to write values from an asp.net form into an XML type in SQL Server 2005.I have never used XML as a type in SQL Server 2005. How do we write xml into xml type. For example the structure of XML is something like:<application><applicationID = "value"></applicationID><customerName="value></customerName></application>I have to write this kind of XML into the XML type and later retrieve these XML values and populate the form again.Kindly suggest. Thanks a l...

How import mixed data type of Data into SQL Database
 Hi all,    I create Excel sheet name Personal and it contain two columns  which are Name and ID.Now I need to import data from Excel sheet in to SQL Database and I done it.but Problem is if each one Column contain many types of data.in  some data is indicate Nulls after imported data.as follows.Before Import data in Excel Sheet                                    Name ID Harsha...

Parameters in sql, xml type blocks: data types
I have some leftover dreamweaverMX asp.net code that contains a few sql/xml Parameter blocks in an admin-insert-data script: <Parameters> <Parameter Name="@ProductType" Value='<%# IIf((Request.Form("ProductType") <> Nothing), Request.Form("ProductType"), "") %>' Type="WChar" /> as far as specifying a Type, for strings it looks like WChar works, and for dates, Date. What about for truefalse-boolean fields, and numeric integers? thanks chum...

The .Net Data SQL Provider (System.Data.SqlClient) requires Microsoft Data Access Components(MDAC) version 2.6 or later.
I am getting error like The .Net Data SQL Provider (System.Data.SqlClient) requires Microsoft Data Access Components(MDAC) version 2.6 or later. i am working with windowsXP. Already in my system i have MDAC 2.7. I donot know why am i getting error like this. anybody help me please...

How to convert varchar data type into datetime data type without data lose
Hi all, i have stored date as varchar(30) data type and Date format is dd/MM/yyyy now i have to convert it into datatime data type can u help me in query ?  i have 330 records and each recod contain the Date in format of dd/MM/YYYY but due to varchar data type i can not perform calculation on Date so i have to convert into datetime without data lose. please help me in this regard. Best RegardsRameezWaheed  life is name of learning!Mark as an answer if it helps You can check these posts http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2039108&SiteID=17   ...

Set default value of sql image data type to binary data
Does anyone know how to set the default value of an sql image data type in the database to a binary value?  I need to figure out how to convert the image I want to use into the binary data to copy and paste it into the default value and how I format it as the default value.  Any help or other suggestion would be greatly appreciated.  Thanks in advance..Cre8ive Productions, Sales & Service, Inc.Web Site Development - eCommerce SolutionDomain Hosting - Servers - Internet Marketing Hi GuyCre8ive, Usually when I store image into database, I add a field to store the default ...

Retreive xml data from sql 2005 xml data type column
 hi everyone, I am in a messy situation and dieing to get rescued.I have a database with an untyped  xml datatype column named xmlfile.  The xml inside is invoice of customer & looks like this.<User><INVOICE><BILL Time="May 18 2008 12:47AM">0.1869</BILL><BILL Time="May 18 2008  1:00AM">22.25</BILL><BILL Time="May 18 2008  1:00AM">22.25</BILL></INVOICE></User>I wanted to retrieve the <BILL></BILL> Elements and put it through asp:datagrid or asp:repeater . I w...

Web resources about - Bit data type - asp.net.sql-datasource

Data - Wikipedia, the free encyclopedia
For data in computer science, see Data (computing) . For other uses, see Data (disambiguation) . is a set of values of qualitative or quantitative ...

Data stickies, a graphene alternative to flash drives
Data stickies is a design concept, but not necessarily a pipe dream. There’s some real science here. dataSTICKIES are conceptualized to be made ...

Fitbit sued over ‘inaccurate’ data
SMARTWATCH brand Fitbit has been hit with a class-action suit filed by customers who say the gadgets’ measures are wildly — and dangerously — ...

Report: Apple making tool to let iPhone users easily transfer data to Android following EU telecom operator ...
... a Move to iOS app in September, pictured, that enables Android users to quickly transfer documents, photos, contacts and other personal data ...

Uber to encrypt rider geo-location data, pay $20,000 to settle NY privacy flap
(credit: Uber ) On Thursday, Uber settled with New York state authorities, paying a $20,000 fine to end investigations into two data breach ...

Microsoft will sell mobile data plans to Windows 10 users
Windows 10 users will soon be able to purchase mobile data plans directly from Microsoft. The software giant says that this option will be introduced ...

4 Tips for Visualizing Data With Maps
From a content marketing point of view, data visualization is extremely important . As we move through 2016, we’ll continue to shift away from ...

Asian Stocks Fall Again as China CPI Data Add to Growth Concerns
The Hindu Asian Stocks Fall Again as China CPI Data Add to Growth Concerns Bloomberg Asian stocks declined, after capping their worst week ...

The CEO of T-Mobile got in a fight with a rights group over claims his company is throttling customers' ...
... Foundation) in a foul-mouthed rant. The row comes after the EFF accused T-Mobile of violating Net Neutrality — the principle that all data ...

Asia investors face a week of data deluge
Investors are watching China's every move, as well as a string of interest rate decisions and data points due in the coming days.

Resources last updated: 1/11/2016 3:43:54 AM