User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,860 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,571 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting

'Object variable or With block variable not set' Error

Join Date: Jun 2005
Posts: 1
Reputation: Seposm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Seposm Seposm is offline Offline
Newbie Poster

Re: 'Object variable or With block variable not set' Error

  #3  
Jun 24th, 2005
A couple of things

1. I believe your error is coming from the fact that you have a Function called MonthCheck and a variable called MonthCheck.

2. You are using Visual Studio.net is there a particular reason you are writing classic ASP style spaghetti code instead of using the code behind and web server controls. it might take a little time to get used to, but once you do, you won't believe you ever even tried to do it this way.

3. you really should not just dim a variable, you should define them as a specific type. It makes things so much easier in the long run. For example, you do this:
' Your Code
While MyReader2.Read

Dim DateIssued
Dim DateDay
Dim DateMonth
Dim DateYear

DateIssued = Split(MyReader2.GetValue(2), "/")
DateDay = CInt(DateIssued(0))
DateMonth = CInt(DateIssued(1))
DateYear = CInt(DateIssued(2))
' end of your code
It would be so much easier to do this

Dim DateIssued as Date
DateIssued = ctype(MyReader2.GetValue(2),Date)

Then you could easily use the built in Date Functions DateIssued.Month, DateIssued.Day etc...

4. It looks like you are using a combination of classic ASP and ASP.net. While this approach can work, it has been my experience that it is usually easier to rewrite the entire application in .net then just part of it.

Finally, I would drop the monthcheck function completely. Try this instead:
First Dim MonthCount as an integer then you can do this
Monthcount.ToString.PadLeft(2, "0")

That would automatically add a 0 to the left of a single digit month number.


Hope this helps, I don't mean to be critical of your style of coding, I know we all learn at different speeds and are all at different stages of development. One of the things i love about ASP and ASP.net is there are an almost unlimited number of ways to accomplish a task. But I was looking over what it is that you are doing and I would bet that I could rewrite the page using less than half the code doing it the .net way even if you replaced the person_proccess.asp page you could still probably do it in less code that you typed for this page.

Seposm
Reply With Quote  
All times are GMT -4. The time now is 6:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC