Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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
  • 33,101 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