Solved

Urgent : Insert Null into Datetime field

Posted on 2002-03-15
5
336 Views
Last Modified: 2008-02-01
Hi All,

How do I insert Null value into datetime field from
my VB Dll.

Thanks and Regards,
Mukesh
0
Comment
Question by:mukeshkm
  • 2
  • 2
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6867598
The answer depends on the way you are currently working:
* using SQL statements
* using updatable recordsets
* using stored procedures

Please indicate, maybe including your code that doesn't work.

Cheers
0
 

Author Comment

by:mukeshkm
ID: 6867623
Hello angellll

what Iam looking at is inserting a record using
SQL statement in my VB function. A friend of mine
put this question to me. Sorry I donot have the
source ...

Mukesh
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6867635

sql = "INSERT INTO yourtable (col1, col2, datecol) VALUES ( 1,2, NULL )"

If you have SQL string you want to execute, you give NULL as value (no quotes, no brackets).

CHeers
0
 
LVL 7

Accepted Solution

by:
simonsabin earned 200 total points
ID: 6867983
If you are using a recordset then set the value of the relevant field to vbNull
0
 

Author Comment

by:mukeshkm
ID: 6868042
thanks simonsabin it works

thanks to angelll too

rgds,
mukesh
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now