[email protected] - Thursday, July 14, 2011 2:25 PM:
Hi, All:
I'm trying to use applySQL() for the first time and can't get it to work. I've written some very simple C# just to see if I could make a connection to the db and it keeps throwing an error:
Innovator myInnovator = new Innovator();
string sql = "SELECT TOP 1 * FROM myTable";
Item results = myInnovator.applySQL(sql);
I wrote this as a server side C# method that is triggered by the form's onLoad event. I get an error saying a semicolon was expected. The query works fine in SS Management Studio. When I comment out the applySQL line there are no errors, so the Innovator is instantiating fine. Any advice about how to modify this?
Thanks,
Jeremy
Hrishikesh - Friday, July 15, 2011 2:51 PM:
Hi,
I have not used a c# method on the Form's onLoad event.
I copied your code to c# method made some changes and run through Action at Menu "Run Server Method".
Innovator myInnovator = getInnovator(); // or u can use "this.newInnovator()"
string sql = "SELECT TOP 1 * FROM myTable";
Item results = myInnovator.applySQL(sql);
return myInnovator.newError(results.ToString()); // It is for POP the Result. (as alert message)
return this;
I have changed the "new Innovator()" to "getInnovator",
In C# code at the end of method we should write return this; or return myInnovator.newResult("");
This code should help you.
Thanks,
Hrishikesh
[email protected] - Friday, July 15, 2011 2:59 PM:
Thanks very much ! I'll try it right now.
*******************************************
Well, that helped. I didn't know you could run the code from the actions menu, I'm getting different results now than when I just loaded the form.
I think the query ran okay, but the result is an error. It's some kind of really, really long string of letters and numbers so I don't know what it means. I'll try to figure that out next. Thanks for your help!