Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

VB .net help ;(


  • Please log in to reply

#1
Simondo

Simondo

    Member

  • Member
  • PipPipPip
  • 113 posts
Heya,

I need to insert this value into a table but make sure that it accepts null values, can anyone help?

CheckString(RemoveCarriageReturns(dreader.GetString(2)))
  • 0

Advertisements


#2
Simondo

Simondo

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 113 posts
'fill table with order items
[/code]
		dbconnection2.Open()
		dbcommand2.CommandText = "select orderitemid,qty,description,despatched from tblorderitem where orderid = " & gloOrderID
		dreader = dbcommand2.ExecuteReader
		While dreader.Read
			dbconnection.Open()
			dbcommand.CommandText = "insert into " & tmptable & " (orderitemid,qty,description,despatched,outstanding,thisdelivery) values(" & dreader.GetInt32(0) & "," & dreader.GetInt32(1) & ",'" & CheckString(RemoveCarriageReturns(dreader.GetString(2))) & "'," & dreader.GetInt32(3) & "," & dreader.GetInt32(1) - dreader.GetInt32(3) & ",0)"
			dbcommand.ExecuteNonQuery()
			dbconnection.Close()
		End While
[code]

  • 0

#3
Simondo

Simondo

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 113 posts
Do'h you cant see it all. Hopefully top post is all you need. Thanks!
  • 0

#4
Simondo

Simondo

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 113 posts
Fixed!

Thanks anyway :)
  • 0

#5
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 32,901 posts
Hi Simondo,

Did you use a Nullable type or find another solution?
Maybe it can help someone else having a similar problem.
  • 0

#6
Metaphysical

Metaphysical

    New Member

  • Member
  • Pip
  • 6 posts
I presume your removecarriagereturns is a function or a sub somewhere, and that you modified that to ignore nulls.
  • 0

#7
Metaphysical

Metaphysical

    New Member

  • Member
  • Pip
  • 6 posts
My bad. Isn't it just something along the lines of:

IIf(IsDBNull(CheckString(dreader("description"))), "", RemoveCarriageReturns(CheckString(dreader.GetString(2)))
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP