473,416 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Coverting data

Hi and TIA. I have a datagride that has one field that is a true/false.
This data is returned from an sql db table and the data type is bit. The
data gride always displays true or false while the bit field is obviously 1
or 0 which is ok. My problem is that if/when I update other fields on that
record I get an error cause it doesn't convert the true/false back to a
bit(1-0). So how can I convert either the display in the grid to display
the actual value (1 or 0) or convert the true/false to a 1 or 0 before
executing the update? Thanks for your help. Below is a sample of what I'm
doing. Thanks for your time.

Dim txtApproved As TextBox
Dim bolApproved As Boolean
txtApproved = e.Item.Cells(5).Controls(0)
bolApproved = txtApproved.Text
cmdSelect.Parameters.Add("@approved", txtApproved.Text)
--

******************
Reggie
Nov 23 '05 #1
1 915
I think I figured it out. Made these changes and it seems to work.
Dim txtApproved As TextBox
Dim bolApproved As Boolean
txtApproved = e.Item.Cells(5).Controls(0)
bolApproved = txtApproved.Text

cmdSelect.Parameters.Add("@approved", SqlDbType.Bit).Value = bolApproved


--

******************
Reggie
"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:d8******************************@comcast.com. ..
Hi and TIA. I have a datagride that has one field that is a true/false.
This data is returned from an sql db table and the data type is bit. The
data gride always displays true or false while the bit field is obviously
1 or 0 which is ok. My problem is that if/when I update other fields on
that record I get an error cause it doesn't convert the true/false back to
a bit(1-0). So how can I convert either the display in the grid to
display the actual value (1 or 0) or convert the true/false to a 1 or 0
before executing the update? Thanks for your help. Below is a sample of
what I'm doing. Thanks for your time.

Dim txtApproved As TextBox
Dim bolApproved As Boolean
txtApproved = e.Item.Cells(5).Controls(0)
bolApproved = txtApproved.Text
cmdSelect.Parameters.Add("@approved", txtApproved.Text)
--

******************
Reggie

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jools | last post by:
We have clients insisting on using IIS4 and the code (written by someone else who left the company before I joined) is ASP3. I am no expert in ASP so can you give any suggestions or recomendations...
0
by: Casey | last post by:
Hi! I found several resources describing how to convert the UNIX timestamp to a readable date, however I need to convert a date into a UNIX timestamp. For instance, I'm writing a program that will...
2
by: Ayo Ogundahunsi | last post by:
Hi, I have this method - GetConnection in a different namespace, DLL so that i can reuse it. namespace MyCompany.ClassLibrary.Data { /// <summary> /// This Class contains database,...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
1
by: rileo8 | last post by:
Hi, i have a file with a part of ASCII code and a second part with binary data that should represent unsigned int. I found how to read the file and write on another file the same binary data, but i...
1
by: Prejith | last post by:
hi my input through the Gui would be 02,03,aa,ab, etc.. i would accept take thes inputs using JoptionPane.showInputDialog("Enter the data bytes seperated by a Comma"); say i would input...
0
by: santoshsri | last post by:
Hello, I have written a Console application in C#, it basically imports data from tab delimited text files and save in SQl Server database. I am converting currency format of Mortgage value into...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.