Thanks for your response to my posting Gregory.
I take your point about isnull(integervar) being inappropriate
I also found isEmpty() wasn't available
If Not (RestaurantId.HasValue) Then
Looks like there's a whole world there that I don't know about
Can't seem to find a list of HasValue and similar 'Natives' to Vb.Net
in the help files [In fact notNull and isEmpty are (confusingly)
covered with examples in Help!]
This is only valid with nullable types, which are declared, in VB, like
so:
Dim RestaurantId as Nullable(Of Integer)
You can then use the HasValue test on it.If you use a standard Integer,
it will fetter out like this:
Dim RestaurantId as Integer
Console.WriteLine(RestaurantId)
This will print 0, not Nothing or Null, as Integers are automatically
initialiazed. Strings will stay null however.
OR intellisense so, if I type
If Not(RestaurantId.
HaveValue doesn't appear in the(all) list of possibilities
Only with nullable types.
What I'm trying to do is Transform responses on a web page into a
vb.net structure (trying to use a 'class' to do this) Then have
methods in the class which will write/read/edit the database My first
attempt at using classes! as you migh have guessed.
Something like this:
Dim RestaurantIdString as String = Request("RestaurantId")
If Not(RestaurantId Is Nothing) Then
'Run code for restaurant
Else
'Run code indicating there is no restaurant with this id
End If
You can then turn the Restaurant Id into an integer, like so:
If Not (RestaurantId Is Nothing) Then
Dim RestaurantId as Integer
If(Int32.TryParse(RestaurantIdString, RestaurantId) Then
'Process ID
End If
End If
Patrice above has suggested using Linq or Entity Framework tools. I'll
have a looksee.
I think LINQ can solve a lot of problems, but if getting the Id off the
query string is the biggest issue, you still have to solve that.
Hopefully, I have given you some good pointers.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************