Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 15th, 2005, 10:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default getdate Not Working

I have a table with a datetime field with default value set to (getdate()) but when I insert a record from my ASP.NET page it doesn't put anything in the field (leaves it null). If I change the option for "Allow nulls" I get an error...

???

-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
Reply With Quote
  #2 (permalink)  
Old July 15th, 2005, 02:58 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

can you post your ASP.NET code?

Reply With Quote
  #3 (permalink)  
Old July 15th, 2005, 03:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default

Dim objConn As SqlConnection
        Dim objAdapter As SqlDataAdapter
        ' Dim objTable As DataTable
        Dim objNewRow As DataRow
        Dim objBuilder As SqlCommandBuilder

        objConn = New SqlConnection(m_connString)
        objAdapter = New SqlDataAdapter("Select * from tblExam", objConn)
        objAdapter.FillSchema(m_Dataset, SchemaType.Source)
        objNewRow = m_Dataset.Tables(0).NewRow()
        objNewRow.Item("Name") = m_ExamName
        objNewRow.Item("IDP") = m_IDP
    m_Dataset.Tables(0).Rows.Add(objNewRow)
        objBuilder = New SqlCommandBuilder(objAdapter)
        objAdapter.InsertCommand = objBuilder.GetInsertCommand
        objAdapter.UpdateCommand = objBuilder.GetUpdateCommand
        If objAdapter.Update(m_Dataset.Tables(0)) >= 1 Then
            Return 1
        Else
            Return 0
        End If

-------------------------
Beware of programmers with screwdrivers...
Reply With Quote
  #4 (permalink)  
Old September 7th, 2005, 09:24 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think dot net helps your by thinking you forgot to send a value and thus sends a null. What happens if you set the table to not allow nulls. I believe the problem is on the dot net side of things. Question is how to get dot net to not help you I believe.

Reply With Quote
  #5 (permalink)  
Old September 8th, 2005, 12:31 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Can you post the code for objBuilder.GetInsertCommand?

Reply With Quote
Reply


Thread Tools
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
GETDATE? drachx SQL Server 2000 2 February 17th, 2005 08:05 AM
Convert getdate() -> dd/mm/yyyy? minhpx SQL Language 1 January 3rd, 2005 09:30 AM
Using GETDATE in an In-Line function Mitch SQL Server 2000 13 March 25th, 2004 08:46 AM
seconds missing in getdate() stufflebeem SQL Server 2000 1 October 24th, 2003 05:52 PM
GETDATE() dose not......... arshad mahmood SQL Server 2000 2 August 19th, 2003 08:57 AM



All times are GMT -4. The time now is 03:41 PM.


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