Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: Database: MS SQL Server
 Need some help, Big SQL problem
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kythor
Starting Member

Belgium
3 Posts

Posted - 02 May 2004 :  17:16:41  Show Profile  Visit Kythor's Homepage
Hi Guys, my forum is at www.thisisbasketball.be/forum

I used an Access database but the db file became to big (150 Mb) so I switched to MS SQL Database.

The conversion of the tables and records worked fine, but there is something wrong with de fields that are empty.
The Snitz code (or the SQL Server) isn't working very well with NULL Values I guess.

If you go to a topic on my forum, you will see a part of the first reply but then there is this error:

Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: " "]'

/forum/inc_func_common.asp, line 881


This is a big problem because nobody can read the topics anymore.
After a lot of searching I narrowed down the problem.
In the Table FORUM_TOPICS/FORUM_REPLY you got the field T_LAST_EDIT. This holds the date of the last edit. When a topic hasn't been edited, this field is left blank (NULL??).
The code isnt processing this "blank value" correctly, so it gives the above error (I think).

This is the part of the code where things go wrong:
function chkDate(fDate,separator,fTime)
if fDate = "" or fDate = " " or isNull(fDate) then exit function
if fTime then
chkTime(fDate)
end if

end if

select case strDateType
case "dmy"
chkDate = Mid(fDate,7,2) & "/" & _
Mid(fDate,5,2) & "/" & _
Mid(fDate,1,4)
case "mdy"
chkDate = Mid(fDate,5,2) & "/" & _
Mid(fDate,7,2) & "/" & _
Mid(fDate,1,4)
case "ymd"
chkDate = Mid(fDate,1,4) & "/" & _
Mid(fDate,5,2) & "/" & _
Mid(fDate,7,2)
case "ydm"
chkDate =Mid(fDate,1,4) & "/" & _
Mid(fDate,7,2) & "/" & _
Mid(fDate,5,2)
case "dmmy"
chkDate = Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),1) & " " & _
Mid(fDate,1,4)
case "mmdy"
chkDate = Monthname(Mid(fDate,5,2),1) & " " & _
Mid(fDate,7,2) & " " & _
Mid(fDate,1,4)
case "ymmd"
chkDate = Mid(fDate,1,4) & " " & _
Monthname(Mid(fDate,5,2),1) & " " & _
Mid(fDate,7,2)
case "ydmm"
chkDate = Mid(fDate,1,4) & " " & _
Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),1)
case "dmmmy"
chkDate = Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),0) & " " & _
Mid(fDate,1,4)
case "mmmdy"
chkDate = Monthname(Mid(fDate,5,2),0) & " " & _
Mid(fDate,7,2) & " " & _
Mid(fDate,1,4)
case "ymmmd"
chkDate = Mid(fDate,1,4) & " " & _
Monthname(Mid(fDate,5,2),0) & " " & _
Mid(fDate,7,2)
case "ydmmm"
chkDate = Mid(fDate,1,4) & " " & _
Mid(fDate,7,2) & " " & _
Monthname(Mid(fDate,5,2),0)
case else
chkDate = Mid(fDate,5,2) & "/" & _
Mid(fDate,7,2) & "/" & _
Mid(fDate,1,4)
end select
if fTime then
chkDate = chkDate & separator & chkTime(fDate)
end if

end function


I changed the code a bit (red part) so it would catch the "blank value" and exit the function immidiately. This doesnt seem to work because whatever value I put in fDate it will always execute the GREEN part.

The problem is quite simple, it tries to process a blank value as a date, giving the "type mismatch" error.

I'm at a loss here, I need to get my forum back up and running or else I will lose a lot of visitors.

Any suggestions or solutions, I need some big help.

Failure is not trying and failing, but in failing not to try

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 02 May 2004 :  17:34:04  Show Profile  Send ruirib a Yahoo! Message
How did you convert the Access DB? Did you follow the guidelines we have posted so often at these forums, as explained, for example, here: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=31144


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Kythor
Starting Member

Belgium
3 Posts

Posted - 02 May 2004 :  17:51:03  Show Profile  Visit Kythor's Homepage
To convert my DB, I did the following:

use access dump to dump the tables and records in SQL Script files.
Made an empty SQL db and run the scripts using TSQL tool.
once every table and record was put in the db, I changed Identity to Yes for the necessary fields in the db.
I also set the default values correctly.

I think the conversion went fine. In fact everything works on the forum, they can even add a new topic or reply. But when they open a topic, they get that error.

Strange thing is, topics that were edited by the creator can be read without problems. Unedited topics give the error.

I made a new topic (not edited). Also that topic is readable.

I don't know where the problem really is.


Failure is not trying and failing, but in failing not to try
Go to Top of Page

Kythor
Starting Member

Belgium
3 Posts

Posted - 02 May 2004 :  18:02:41  Show Profile  Visit Kythor's Homepage
I just fixed the problem.
apparently with converting the data for FORUM_TOPIC/FORUM_REPLYS, he inserted 14 space chars in the field T_LAST_EDIT in stead off NULL or "".

So to get it to work, I changed the code to

if fDate = "(14 spaces)" .... then
exit function
end if

untill now it works...

Failure is not trying and failing, but in failing not to try

Edited by - Kythor on 02 May 2004 18:03:06
Go to Top of Page

zonelinks
Starting Member

India
11 Posts

Posted - 13 May 2004 :  03:09:14  Show Profile
Even i am not getting the actual problem that u r facing....

--------------------------
http://www.zonelinks.com
---------------------------
The power Link Dimension
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07