index > .NET Framework Data Access and Storage > DataType Yes/No

DataType Yes/No

Using Access as a database

On the Insert Command how do I do a field that has a data type of Yes/No.

is it sql +="0,";

or sql+="'0'";

or what

Thanks in advance.

Can-Ann

that would be a Bit value (1/0, yes/no, true/false) so itll just be 0 (for false) or 1 (for true):

sql += "0";

Also looks like you are using standard SQL "injection" - I would recommend using Stored Procedures as they are fast and secure and you don't need to worry about building the query string/SQL String/statement as it would be stored in the SPROC itself on the SQL Server. All you would have to do is supply the correct parameters with values in your Client app and call the stored procedure and thats it.




Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
ahmedilyas

Should be a numeric value, any non-zero value evaluates to True (-1) and of course zero evaluates to False (0) in Microsoft Access.


Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV
my bad, was thinking Access in one part of my mind and SQL in another.


Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
ahmedilyas

Yeah, but you're pretty much on the right track. In the Access world a QueryDef is kind of like a stored procedure and it's safer than SQL, although there's not really much of any performance difference.


Paul ~~~~ Microsoft MVP (Visual Basic)
Paul P Clement IV
reply 5

You can use google to search for other answers

 

More Articles

• QUERY written in MS Access does not work with adodb
• jro.refreshcache on oledbconnection??? (provider=Jet)
• is it possible to interrupt fill method of the data adapter?
• retrieve schema info for a SQL statement in sql datatypes
• Rollback during Thread.Abort exception on 2.0
• ODBC TableAdapter Updating
• How to get a file stored in an Access database?
• Problems with running an Access macro in VS 2005
• Update issue vb.net2005 express - SQLServerExpress "Failed t...
• mapping issue with sql executenonquery method
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• check user input data exist in database
• Dataview Sort Problem
• TableAdapter insert/update/delete order
• Mysql connection
• How to avoid re-occurring Err "ORA-
• Execute a sql script using vb.net
• ExecuteReader requires an open and avail
• Enterprise Library for .NET Framework 2.
• SQLExpress and VS 2005 - Internal .Net F
• DateTime Conversions
• Update query in DeleteCommand
• Add new Record in VB 2005
• ExecuteNonQuery asynchronously
• ODBC or OLEDB
• ADO.NET vNext : System.Data.DataRowView

Hot Articles

• Suppressing display of duplicate values
• Updating SQL Server using DataSet
• Can't connect to database from web servi
• oracleCommand error
• Problems connecting to sql 2005 express.
• Visual Studio 2005
• An error has occurred while establishing
• Using diffgram to update database
• Connect to a Sybase Adaptive Server Anyw
• parameter Array in Stored Procedure
• Save DataTable to new Databasefile
• Default Values with a DataSet and SQL Se
• edit/update on detailsview throws except
• Sql database network connection
• About Connection and Disconnected Archit

Recommend Articles

• Single DateSource - Multiple Databases
• Problem Importing Data From Excel
• QUERY written in MS Access does not work
• Data Sources Window
• import / parse DIF files (Data Interchan
• oracleCommand error
• DataSet thread safety
• Expression Building - Access 2003
• Reading an OLE Object field in a MS Acce
• SQLPrepare(): Debug vs Release
• Problems deleting a record.
• connection and fucntions
• Error when importing an Excel SS into a
• Enterprise Library for .NET Framework 2.
• Temp tables in Stored Procedure