Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 10th, 2005, 07:40 AM
Registered User
Join Date: Jan 2005
Location: Delhi, Delhi, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default syntax for storing chr(0) in sql server through vb

syntax for storing chr(0) in sql server through vb

i am using the following code... Table test123 contains only one field name "a" whose database type is varchar(50)...

    Set conn = New ADODB.Connection
    conn.Open "eastman", "sa", "cosl"
    sql = "insert into test123 values('" & "'" & Chr(0) & "'" & "')"
    Set rs = conn.Execute(sql)

But this is throwing an error..Plz suggest

Reply With Quote
  #2 (permalink)  
Old January 10th, 2005, 02:20 PM
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

You need a receptacle for the value, first of all. You need a table and a column.
Also, your string turns into
    insert into test123 values(''null_here'')
(pairs of single-quotes on each side of a null character).

Try this:

    sql = "INSERT INTO test123 ( fldOne ) " & _
          "VALUES              ( NULL   ) "

    "NULL" should be a named constant that SQL recognizes. (Use a valid column name in place of "fldOne," one which can be set to a NULL value).
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing & retrieving swf file from sql server tarduk2004 ASP.NET 2.0 Basics 2 October 30th, 2007 02:31 AM
C# equivalent function to VB chr for values > 128 relaytest49 ASP.NET 2.0 Professional 0 May 24th, 2006 10:08 AM
storing serialized object in sql server ACE2084 General .NET 0 October 13th, 2005 01:35 PM
Storing E-Invoices (pdf-files) in SQL-Server Gert SQL Server 2000 1 September 17th, 2004 09:07 AM
Storing Graphic Image on Sql Server kasie ADO.NET 3 March 27th, 2004 04:51 AM

All times are GMT -4. The time now is 12:58 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.