|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
isnull ! gives errorusing VB D:\ . . . \WebsiteX\AppCode\WebRecordVb ** code snippet begin ** Imports Microsoft.VisualBasic Public Class WebDbRecord Private RestaurantId As Int32 Private FromWebOrRestaurant As Byte Private SpeedOfService As Byte '. . etc . . Public Function IsValid() As Boolean If isnull(RestaurantId) Then End If End Function End Class ** code snippet end ** Why please is isnull creating a build error - name isnull is not declared ? and what to do about it! Jim Bunton IsNull doesn't exists in VB.NET. Also in this context I'm not sure what you are trying to do (RestaurantId is an integer and will never be null, AFAIK it was previoulsy usefull only with the variant datatype in VB6).
Try http://msdn.microsoft.com/en-us/library/tckcces5(VS.80).aspx (IsDbNull function) or http://msdn.microsoft.com/en-us/library/ms235245.aspx (Nullable value types) or explain what you are trying to do... As a side note Linq To SQL or Entity Framework or any other tool able to map database tables to .NET classes might be usefull for you... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3919ef$0$22371$426a7***@news.free.fr... Visual Web Developer 2008using VB D:\ . . . \WebsiteX\AppCode\WebRecordVb ** code snippet begin ** Imports Microsoft.VisualBasic Public Class WebDbRecord Private RestaurantId As Int32 Private FromWebOrRestaurant As Byte Private SpeedOfService As Byte '. . etc . . Public Function IsValid() As Boolean If isnull(RestaurantId) Then End If End Function End Class ** code snippet end ** Why please is isnull creating a build error - name isnull is not declared ? and what to do about it! Jim Bunton Thanks for your response to my posting Patrice:
Generally what I'm trying to do is I guess is 1. To map some responses on a web page into vb.net structures which I can then manipulate First dissapointment was that I couldn't create a structure datatype! had't found that vb.net is so unlike VB vin ordinaire! So - my first attempt to create a class - to hold the transformed/derived data values in 2. Validate data or whatever (I take your point about an integer never being null - I also found that IsEmpty wasn't available! 3. Design the 'Class' so it would have a method to write/edit/read to and from a database 4. Now hoping that I can figure out how to do the latter using Linq or Entity As you can see - I'm struggling rather with concepts I've never used before with olde world asp & vb Thanks again Jijm "Patrice" <http://www.chez.com/scribe/> wrote in message news:1D49D653-8FC3-4073-8F04-BC3D025DCFA4@microsoft.com... IsNull doesn't exists in VB.NET. Also in this context I'm not sure what you are trying to do (RestaurantId is an integer and will never be null, AFAIK it was previoulsy usefull only with the variant datatype in VB6).Try http://msdn.microsoft.com/en-us/library/tckcces5(VS.80).aspx (IsDbNull function) or http://msdn.microsoft.com/en-us/library/ms235245.aspx (Nullable value types) or explain what you are trying to do... As a side note Linq To SQL or Entity Framework or any other tool able to map database tables to .NET classes might be usefull for you... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3919ef$0$22371$426a7***@news.free.fr... Visual Web Developer 2008using VB D:\ . . . \WebsiteX\AppCode\WebRecordVb ** code snippet begin ** Imports Microsoft.VisualBasic Public Class WebDbRecord Private RestaurantId As Int32 Private FromWebOrRestaurant As Byte Private SpeedOfService As Byte '. . etc . . Public Function IsValid() As Boolean If isnull(RestaurantId) Then End If End Function End Class ** code snippet end ** Why please is isnull creating a build error - name isnull is not declared ? and what to do about it! Jim Bunton Both IsEmpty/IsNull were used with the variant datatype that is gone so those functions are gone...
The Type keyword is now Structure. I would suggest reading at least once the language specification you'll find at msdn.microsoft.com. It will discuss structures, classes and other language constructs... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3a2316$0$10093$426a7***@news.free.fr... Thanks for your response to my posting Patrice:Generally what I'm trying to do is I guess is 1. To map some responses on a web page into vb.net structures which I can then manipulate First dissapointment was that I couldn't create a structure datatype! had't found that vb.net is so unlike VB vin ordinaire! So - my first attempt to create a class - to hold the transformed/derived data values in 2. Validate data or whatever (I take your point about an integer never being null - I also found that IsEmpty wasn't available! 3. Design the 'Class' so it would have a method to write/edit/read to and from a database 4. Now hoping that I can figure out how to do the latter using Linq or Entity As you can see - I'm struggling rather with concepts I've never used before with olde world asp & vb Thanks again Jijm "Patrice" <http://www.chez.com/scribe/> wrote in message news:1D49D653-8FC3-4073-8F04-BC3D025DCFA4@microsoft.com... IsNull doesn't exists in VB.NET. Also in this context I'm not sure what you are trying to do (RestaurantId is an integer and will never be null, AFAIK it was previoulsy usefull only with the variant datatype in VB6).Try http://msdn.microsoft.com/en-us/library/tckcces5(VS.80).aspx (IsDbNull function) or http://msdn.microsoft.com/en-us/library/ms235245.aspx (Nullable value types) or explain what you are trying to do... As a side note Linq To SQL or Entity Framework or any other tool able to map database tables to .NET classes might be usefull for you... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3919ef$0$22371$426a7***@news.free.fr... Visual Web Developer 2008using VB D:\ . . . \WebsiteX\AppCode\WebRecordVb ** code snippet begin ** Imports Microsoft.VisualBasic Public Class WebDbRecord Private RestaurantId As Int32 Private FromWebOrRestaurant As Byte Private SpeedOfService As Byte '. . etc . . Public Function IsValid() As Boolean If isnull(RestaurantId) Then End If End Function End Class ** code snippet end ** Why please is isnull creating a build error - name isnull is not declared ? and what to do about it! Jim Bunton Thanks again Patrice.
I guess reading the language spec, 374 pages! is going to keep me busy for a while. Your pointers as to where to go are much appreciated. Jim "Patrice" <http://www.chez.com/scribe/> wrote in message news:ejEhlpA8JHA.1716@TK2MSFTNGP03.phx.gbl... Both IsEmpty/IsNull were used with the variant datatype that is gone so those functions are gone...The Type keyword is now Structure. I would suggest reading at least once the language specification you'll find at msdn.microsoft.com. It will discuss structures, classes and other language constructs... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3a2316$0$10093$426a7***@news.free.fr... Thanks for your response to my posting Patrice:Generally what I'm trying to do is I guess is 1. To map some responses on a web page into vb.net structures which I can then manipulate First dissapointment was that I couldn't create a structure datatype! had't found that vb.net is so unlike VB vin ordinaire! So - my first attempt to create a class - to hold the transformed/derived data values in 2. Validate data or whatever (I take your point about an integer never being null - I also found that IsEmpty wasn't available! 3. Design the 'Class' so it would have a method to write/edit/read to and from a database 4. Now hoping that I can figure out how to do the latter using Linq or Entity As you can see - I'm struggling rather with concepts I've never used before with olde world asp & vb Thanks again Jijm "Patrice" <http://www.chez.com/scribe/> wrote in message news:1D49D653-8FC3-4073-8F04-BC3D025DCFA4@microsoft.com... IsNull doesn't exists in VB.NET. Also in this context I'm not sure what you are trying to do (RestaurantId is an integer and will never be null, AFAIK it was previoulsy usefull only with the variant datatype in VB6).Try http://msdn.microsoft.com/en-us/library/tckcces5(VS.80).aspx (IsDbNull function) or http://msdn.microsoft.com/en-us/library/ms235245.aspx (Nullable value types) or explain what you are trying to do... As a side note Linq To SQL or Entity Framework or any other tool able to map database tables to .NET classes might be usefull for you... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3919ef$0$22371$426a7***@news.free.fr... Visual Web Developer 2008using VB D:\ . . . \WebsiteX\AppCode\WebRecordVb ** code snippet begin ** Imports Microsoft.VisualBasic Public Class WebDbRecord Private RestaurantId As Int32 Private FromWebOrRestaurant As Byte Private SpeedOfService As Byte '. . etc . . Public Function IsValid() As Boolean If isnull(RestaurantId) Then End If End Function End Class ** code snippet end ** Why please is isnull creating a build error - name isnull is not declared ? and what to do about it! Jim Bunton AS a VB6 developer try perhaps :
http://msdn.microsoft.com/en-us/library/ms172618.aspx (from a whole section for BV6 developer in the VS 2008 help). For the spec, I would say chapter 7 so that you know about handling data. Then perhaps chapter 4 for OOP programming concepts... Then see the chapter titles so that you can pick possible references you would need and try to have a closer look at least once not to be proficient but at least to know what exists so that you can dig deeper as needed... I allow you not to read the grammar summary -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3a420b$0$23515$426a7***@news.free.fr... Thanks again Patrice.I guess reading the language spec, 374 pages! is going to keep me busy for a while. Your pointers as to where to go are much appreciated. Jim "Patrice" <http://www.chez.com/scribe/> wrote in message news:ejEhlpA8JHA.1716@TK2MSFTNGP03.phx.gbl... Both IsEmpty/IsNull were used with the variant datatype that is gone so those functions are gone...The Type keyword is now Structure. I would suggest reading at least once the language specification you'll find at msdn.microsoft.com. It will discuss structures, classes and other language constructs... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3a2316$0$10093$426a7***@news.free.fr... Thanks for your response to my posting Patrice:Generally what I'm trying to do is I guess is 1. To map some responses on a web page into vb.net structures which I can then manipulate First dissapointment was that I couldn't create a structure datatype! had't found that vb.net is so unlike VB vin ordinaire! So - my first attempt to create a class - to hold the transformed/derived data values in 2. Validate data or whatever (I take your point about an integer never being null - I also found that IsEmpty wasn't available! 3. Design the 'Class' so it would have a method to write/edit/read to and from a database 4. Now hoping that I can figure out how to do the latter using Linq or Entity As you can see - I'm struggling rather with concepts I've never used before with olde world asp & vb Thanks again Jijm "Patrice" <http://www.chez.com/scribe/> wrote in message news:1D49D653-8FC3-4073-8F04-BC3D025DCFA4@microsoft.com... IsNull doesn't exists in VB.NET. Also in this context I'm not sure what you are trying to do (RestaurantId is an integer and will never be null, AFAIK it was previoulsy usefull only with the variant datatype in VB6).Try http://msdn.microsoft.com/en-us/library/tckcces5(VS.80).aspx (IsDbNull function) or http://msdn.microsoft.com/en-us/library/ms235245.aspx (Nullable value types) or explain what you are trying to do... As a side note Linq To SQL or Entity Framework or any other tool able to map database tables to .NET classes might be usefull for you... -- Patrice "Jim Bunton" <jBun***@BlueYonder.co.uk> a écrit dans le message de groupe de discussion : 4a3919ef$0$22371$426a7***@news.free.fr... Visual Web Developer 2008using VB D:\ . . . \WebsiteX\AppCode\WebRecordVb ** code snippet begin ** Imports Microsoft.VisualBasic Public Class WebDbRecord Private RestaurantId As Int32 Private FromWebOrRestaurant As Byte Private SpeedOfService As Byte '. . etc . . Public Function IsValid() As Boolean If isnull(RestaurantId) Then End If End Function End Class ** code snippet end ** Why please is isnull creating a build error - name isnull is not declared ? and what to do about it! Jim Bunton
Show quote
Hide quote
"Jim Bunton" <jBun***@BlueYonder.co.uk> wrote in IsNull() is not native in VB.NET. Perhaps in the compatibility namespace news:4a3919ef$0$22371$426a74cc@news.free.fr: > Visual Web Developer 2008 > using VB > > D:\ . . . \WebsiteX\AppCode\WebRecordVb > > ** code snippet begin ** > Imports Microsoft.VisualBasic > > Public Class WebDbRecord > Private RestaurantId As Int32 > Private FromWebOrRestaurant As Byte > Private SpeedOfService As Byte > '. . etc . . > > Public Function IsValid() As Boolean > If isnull(RestaurantId) Then > > End If > End Function > End Class > but not straight up. Also, an int cannot have a null value. It is set to 0 when declared. you can use a nullable int, but the test is: If Not (RestaurantId.HasValue) Then if you are using nullable int. -- Show quoteHide quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ******************************************* | Think outside the box! | ******************************************* 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!] OR intellisense so, if I type If Not(RestaurantId. HaveValue doesn't appear in the(all) list of possibilities 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. Patrice above has suggested using Linq or Entity Framework tools. I'll have a looksee. Thanks again Jim Show quoteHide quote "Gregory A. Beamer" <NoSpamMgbworld@comcast.netNoSpamM> wrote in message news:Xns9C2D81B205F95gbworld@207.46.248.16... > "Jim Bunton" <jBun***@BlueYonder.co.uk> wrote in > news:4a3919ef$0$22371$426a74cc@news.free.fr: > >> Visual Web Developer 2008 >> using VB >> >> D:\ . . . \WebsiteX\AppCode\WebRecordVb >> >> ** code snippet begin ** >> Imports Microsoft.VisualBasic >> >> Public Class WebDbRecord >> Private RestaurantId As Int32 >> Private FromWebOrRestaurant As Byte >> Private SpeedOfService As Byte >> '. . etc . . >> >> Public Function IsValid() As Boolean >> If isnull(RestaurantId) Then >> >> End If >> End Function >> End Class >> > > > IsNull() is not native in VB.NET. Perhaps in the compatibility namespace > but not straight up. > > Also, an int cannot have a null value. It is set to 0 when declared. you > can use a nullable int, but the test is: > > If Not (RestaurantId.HasValue) Then > > if you are using nullable int. > > > -- > Gregory A. Beamer > MVP; MCP: +I, SE, SD, DBA > > Twitter: @gbworld > Blog: http://gregorybeamer.spaces.live.com > > ******************************************* > | Think outside the box! | > ******************************************* Jim Bunton wrote:
> OR intellisense so, if I type ICBW, but, tools->options->text editor->Basic->Auto list members/Hide > If Not(RestaurantId. > HaveValue doesn't appear in the(all) list of possibilities advanced members check box. Andrew
Show quote
Hide quote
"Jim Bunton" <jBun***@BlueYonder.co.uk> wrote in This is only valid with nullable types, which are declared, in VB, like news:4a3a2317$0$10093$426a74cc@news.free.fr: > 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!] 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 Only with nullable types.> If Not(RestaurantId. > HaveValue doesn't appear in the(all) list of possibilities > What I'm trying to do is Transform responses on a web page into a Something like this:> 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. 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 I think LINQ can solve a lot of problems, but if getting the Id off the > have a looksee. query string is the biggest issue, you still have to solve that. Hopefully, I have given you some good pointers. -- Show quoteHide quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ******************************************* | Think outside the box! | *******************************************
Other interesting topics
Is there a way to keep the StreamWriter open?
Visual Basic is Dead! Detailsview updading issue Web Deployment Project - Include Files Movenext and ASP.net enum or static class Skinning Question for checkboxes ie8 javascript "new function" behavior Designing an ASP.NET wizard? Employee TimeSheet/Projects |
|||||||||||||||||||||||