Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I would like to ask how to get connection in WorkflowConsoleApplication with database which is created in SQL Server 2005.

I am trying with these command line but its do not work.

In Program.cs:
C#
const string connString = "Initial Catalog=kino;Data Source=CHACH-KOMPUTER\\SQLEXPRESS;Integrated Security=SSPI;";
workflowRuntime.AddService(new SqlWorkflowPersistenceService(connString));

In Workflow.cs:
C#
string conn = ".;DATABASE=kino;Integrated Security=SSPI;";

I will be greatful for any answers and clues.

Thanks in advance.
Posted
Updated 14-May-13 7:21am
v2
Comments
Richard C Bishop 14-May-13 13:24pm    
Are you sure "CHACH-KOMPUTER\\SQLEXPRESS" is the name of your server?
Member 9987570 14-May-13 15:56pm    
Yes, very sure.
In SQLServer 2005 it is "CHACH-KOMPUTER\SQLEXPRESS"
but in VisualStudio2012 in the line with connection string I have to put two backslashes:
"CHACH-KOMPUTER\\SQLEXPRESS"
otherway it underlines the only one backslash in the code with little snake-line
"CHACH-KOMPUTER\SQLEXPRESS", something like that ;)
~

The problem is most likely related to your connection string. You can check for that by trying to connect to the database
C#
SqlConnection conn = new SqlConnection(connString);
conn.open();
conn.close();

If the above code throws an exception then indeed it is your connection string. You can try to fix it yourself or have a look at this article for more information.

http://msdn.microsoft.com/en-us/library/ms254947.aspx[^]

However if you are able to connect to the database, then the problem lies within the workflowRuntime object. If you post more details on the exception that you are getting I am sure some one will be able to help you further.
 
Share this answer
 
Yes indeed, the code throws me an exception:

Troubleshooting Exceptions: System.Data.SqlClient.SqlException

In the line:
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowConsoleApplication4.Workflow1));

>>>Could not find stored procedure 'RetrieveNonblockingInstanceStateIds'.

I am not sure because do not remember (I did some project in the ppast) but I have a light in my head and maybe it is something with the backslash in this line:

const string connString = "Initial Catalog=kino;Data Source=CHACH-KOMPUTER\\SQLEXPRESS;Integrated Security=SSPI;";

or something else which is very simple to fix but for now I can not figure it out.

I will keep digging before it starts annoying.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900