locked
Connection string not set - cannot get data design context RRS feed

  • Question

  •  In the windows mobile 6.1 professional smart device application given to me,web service and Compact db 3.5 is used.

    when the application is running I just quered the Compact db at run time ,all  tables do not contain data.
    always the db is empty.

    I feel no RDA or merge replication used here.(because,the application architecture states "the only way to query db is through webservice")

    Also, in the xsd,I right cliked method of a datatable->preview data->,click Preview button.
    I got error messagebox:

    "class.getuser() could not be previewed.
    Connection string not set -cannot get data design context
    "



    actually if we attach the compact db we get the Xsd in solution explorer.

    also,I did not developed the application;client had given to me for enhancement.

    Please let me know if you need more details.

    Thursday, February 12, 2009 1:30 PM

Answers

  • What if you create a new dataset? Is the dataset shown in the Data Source view correctly? I would suggest that you create a new dataset and make sure it can connect to the database. The following article may help you with it:
    How to: Add a SQL Server Compact 3.5 Database to a Project



    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    • Marked as answer by warrentang Wednesday, February 18, 2009 7:31 AM
    Tuesday, February 17, 2009 9:38 AM

All replies

  • In the application given to me,web service and Compact db 3.5 is used.

    when the application is running I just quered the Compact db at run time ,all  tables do not contain data.

    I feel no RDA or merge replication used here.(because,the application architecture states "the only way to query db is through webservice")

    Also, in the xsd,I right cliked method of a datatable->preview data->,click Preview button.
    I got error messagebox:

    "class.getuser() could not be previewed.
    Connection string not set -cannot get data design context
    "
    Wednesday, February 11, 2009 12:52 PM
  • Hi bharathi_m,

    Can you provide detailed steps to reproduce your problem?


    Best regards,
    Guang-Ming Bian - MSFT
    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Friday, February 13, 2009 7:23 AM
  • OK.I got error in an application given to me by my customer for enhancement.
    PLease try to give some of the situation why the dataset fails to connect throuh the connectionstring

    "Connection string not set -cannot get data design context"



    Friday, February 13, 2009 10:03 AM
  • Hi,

    Right click on the dataset (.xsd) in the Solution Explorer and then select "View Code", make sure the connection string is configured properly. Here is a sample:

            <Connections>
              <Connection ConnectionStringObject="Data Source=.\AppDatabase1.sdf" IsAppSettingsProperty="false" Modifier="Assembly" Name="AppDatabase1.sdf" ParameterPrefix="@" Provider="Microsoft.SqlServerCe.Client.3.5" />
            </Connections>

    In particular make sure the ConnectionStringObject attribute is set:
     ConnectionStringObject ="Data Source=.\AppDatabase1.sdf"

    Regards
    Chunsheng Tang
    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    Tuesday, February 17, 2009 4:02 AM
  • Chunsheng Tang said:

    Hi,

    Right click on the dataset (.xsd) in the Solution Explorer and then select "View Code", make sure the connection string is configured properly. Here is a sample:

            <Connections>
              <Connection ConnectionStringObject="Data Source=.\AppDatabase1.sdf" IsAppSettingsProperty="false" Modifier="Assembly" Name="AppDatabase1.sdf" ParameterPrefix="@" Provider="Microsoft.SqlServerCe.Client.3.5" />
            </Connections>

    In particular make sure the ConnectionStringObject attribute is set:
     ConnectionStringObject ="Data Source=.\AppDatabase1.sdf"

    Regards
    Chunsheng Tang


    Please mark the post that helps you, and unmark that does not. This benefits our community members.



    hi Chunsheng Tang,

    I checked it:<Connections><Connection ConnectionStringObject="Data Source=.\Mobile.sdf;Password=ffmdb;Persist Security Info=True" IsAppSettingsProperty="false" Modifier="Assembly" Name="MobileConnectionString" ParameterPrefix="@" Provider="Microsoft.SqlServerCe.Client.3.5" /></Connections>

    It is correct.
    Tuesday, February 17, 2009 9:17 AM
  • What if you create a new dataset? Is the dataset shown in the Data Source view correctly? I would suggest that you create a new dataset and make sure it can connect to the database. The following article may help you with it:
    How to: Add a SQL Server Compact 3.5 Database to a Project



    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    • Marked as answer by warrentang Wednesday, February 18, 2009 7:31 AM
    Tuesday, February 17, 2009 9:38 AM