Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently October 19th, 2024, 12:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Can Opus create a table within MS Access and name it?
PostPosted: June 4th, 2015, 9:37 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
I am writting a publication, and need to know if it is possible for Opus to create tables within MS Access and rename the table to the User's name.


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 4th, 2015, 10:59 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Probably, yes. You can do that over ODBC which is what you'll use for your Opus connection. Though, as there is not an Opus action, you'll have to use the Opus Script method and workout the exact SQL code needed for creating a new table.

If you've not used Scripting for database before, then I'd search the forum as there will be examples relating to connection and sending and receiving data.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 4th, 2015, 12:45 pm 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
I've been searching the forum for more than a couple of days with no luck. The best I got was:

$connect = mysql_connect("FILEDSN=C:\Users\Anton\Documents\connection1.dsn;")
$db = mysql_select_db("Candidates Detail",$connect);
$query = "CREATE TABLE employees (FirstName varchar(15),LastName varchar(15),Age int)";
$result = mysql_query($query, $connect);

and

var myDB = new Database("FILEDSN=C:\Users\Anton\Documents\connection1.dsn;")
var Rset = myDB.ExecuteSQL("CREATE TABLE employees (FirstName varchar(15),LastName varchar(15),Age int)")

but both examples did nothing.


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 4th, 2015, 2:21 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Did you check that the connection was sound and that you can do something basic, like select data from an existing table?

I tried a simple example and it worked using:

Code:
var myDB = new Database("FILEDSN=b:\demo.dsn;");
myDB.ExecuteSQL("CREATE TABLE p_addresses (street varchar(15))");


</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 4th, 2015, 3:06 pm 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
I see know I cant connect to my database using script after publishing, them my DSN is incorrect, I am using the correct path though "FILEDSN=C:\Users\Anton\Documents\connection1.dsn;" is the error is in this line?

var myDB = new Database("FILEDSN=C:\Users\Anton\Documents\connection1.dsn;")


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 5th, 2015, 8:15 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Thank You Mackavi for your time and help, without you I would have never solve this problem.

The correct code is:

var myDB = new Database("FILEDSN=C:\\Backup\\CBT\\Published\\J281 Ross Operators\\Data\\database.dsn");
myDB.ExecuteSQL("CREATE TABLE " + COMMAND_PARAM_2 + " (street varchar(15))");


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 5th, 2015, 8:18 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Glad it's working.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 5th, 2015, 2:30 pm 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
I need your help again haha..

I am trying to create a table with the users name and idnumber as the name of the table, the code works fine except when the user's name got a space somewhere then no table will be created in MSACCESS (I don't know why), do do you know the solution to this problem, or how can I force the "loginuser" to leave out all the spaces or be replaced by a underscore

Code:
var myDB = new Database("FILEDSN=C:\\Backup\\CBT\\Published\\J281 Ross Operators\\Data\\database.dsn");
myDB.ExecuteSQL("CREATE TABLE " + loginuser + "_" + loginidnumber + "  (street varchar(15))");


Please help.


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 6th, 2015, 11:07 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Mackavi gave you a solution in your other post on the same/similar topic --- using split and join to replace spaces with underscore characters. e.g., john tachkov ===> john_tachkov

But you probably have to dig a little deeper and monitor what values your variables are carrying when you attempt to CONCATENATE strings.

Suggest you use Debug.trace and examine some of the strings or numbers your fields or variables hold. You will have to go further than just looking at them --- do some tests to ACTUALLY SEE what an arithmatic operation returns, and what a string concatenation returns. You may have to convert some data explicitly to strings... in order to concatenate and achieve the expected output.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Can Opus create a table within MS Access and name it?
PostPosted: June 8th, 2015, 8:13 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Thank you Lar,

using split and join to replace spaces worked like a charm.


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group