Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
I need to pass parameters to my SQL query to create a Table in SR. However I am getting following error "Command text was not set for the command object." Could anybody help me resolve this issue. SQL query : select * from table1 where columns_name = @PL Pre SQL statement : Quote:@using Seal.Model @{ var PL = "3000"; } Sorry for the very simple thing, I am new to Razor scripting. Edited by user Friday, November 20, 2015 9:30:58 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
razor script are just c# in which property do you want to use it ?
|
|
|
|
Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
I need this in table's SQL statement.
I have case statements in my SQL query, and i need to pass restriction values over to case statement conditions.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
you can use razor script only in the following table properties: Pre SQL Statement Post SQL Statement Additional WHERE Clause: this one can add dynamically restrictions to your table, check the sample provided.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 11/4/2015(UTC) Posts: 17 Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
I am using razor script in Pre SQL statement.In there i am creating a variable called 'PL' and using that in my table's SQL query. But its giving " Command text was not set for the command object." error for me. Quote: @using Seal.Model @using Seal.Helpers @{ string PL = string.Format("", Helper.QuoteSingle("3000")); } @Raw(PL)
Please see the code snippet above Edited by user Friday, November 20, 2015 11:37:46 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Yes, the pre-SQL (or post-SQL) is done to send an SQL command to the database (e.g. creating a table or a view) So it must be a SQL statement it has no link with the SQL generated.
I think you should not use this for your purpose.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.