Creating Table with Random Number

This is a discussion on "Creating Table with Random Number" within the Classic ASP section. This forum, and the thread "Creating Table with Random Number are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Jun 1st, 2006, 06:54
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,668
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Creating Table with Random Number

This was sent to me as a private message, thought more people could help if it was here.

On behalf of cnn777:
Quote:
Hi -
I am new at ASP but have some good PHP experience.
I wrote a program in PHP that I need converted into ASP
Basically, I need some ASP code that will create tables in an SQL database called "test"
Everytime I access the ASP, the page needs to generate a random number, then use that random number as the table name.

This is the database structure:
Database: Test
Table 1: myrandomtable 39483438734
Table 2: myrandomtable 40584504584
Table 3: myrandomtable 93473497397
etc.
I tried this in ASP:
<%
dim thisrandomnumber
thisrandomnumber= rnd
strSQL = "CREATE TABLE" & " " & thisrandomnumber & " " &
"(" PK_id INTEGER PRIMARY KEY etc.
I keep getting errors - no idea why
I response.write the value and it looks like a random number
The SQL or ASP Parse error says:
'3498734' error
Help
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)

Last edited by spinal007; Jun 1st, 2006 at 06:58.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jun 1st, 2006, 06:57
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,668
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
Re: Creating Table with Random Number

I think you need to be a bit clearer for us to help you.

1. At which point of the code exactly does the error happen?
2. What is the exact error message you're getting?
3. MSSQL or MySql?

Things you should do, first of all...

Since you're dynamically generating the SQL code, have you tried displaying it on the page?
This way you can see if the code you're trying to execute is what it should be. Look for missing brackets, quotes, etc...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
creating, table, random, number

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Number one unitedcraig Search Engine Optimization (SEO) 21 Apr 18th, 2008 19:29
[SOLVED] Help Creating New .SQL Table (Beginner) Aaron1988 Databases 16 Nov 4th, 2007 17:17
Creating a scroll bar within a table Diablo Web Page Design 5 Mar 12th, 2007 16:10
Need to align width of Float table with the table below Vertabase Web Page Design 4 Mar 8th, 2006 21:21
random number generation djme PHP Forum 2 Dec 28th, 2005 05:15


All times are GMT. The time now is 05:58.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42