Monday, August 5, 2013

SQL Compact Godaddy

Scott Guthrie has explained in detail regarding SQL Compact CE 4.0 embedded database in his article.

Godaddy customer support idiots have mentioned, they don't support SQL Compact CE 4.0. Read their post

Below are the steps you need to follow while hosting SQL Compact CE 4.0 with Godaddy

1. You can have multiple ".sdf" files in your "App_Data" folder

2. You need give read / write access to the above folder (or wherever your .sdf files are located). Also make sure that, there is no read-only attribute checked on your .sdf files

3. Go to your "bin" folder of your application

4. The folder structure should be like below

bin\System.Data.SqlServerCe.dll

bin\amd64
bin\amd64\Sqlceca40.dll
bin\amd64\Sqlcecompact40.dll
bin\amd64\ Sqlceer40EN.dll
bin\amd64\Sqlceme40.dll
bin\amd64\Sqlceqp40.dll
bin\amd64\Sqlcese40.dll
bin\amd64\Microsoft.VC90.CRT
bin\amd64\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest
bin\amd64\Microsoft.VC90.CRT\msvcr90.dll

bin\x86\Sqlceca40.dll
bin\x86\Sqlcecompact40.dll
bin\x86\Sqlceer40EN.dll
bin\x86\Sqlceme40.dll
bin\x86\Sqlceqp40.dll
bin\x86\Sqlcese40.dll
bin\x86\Microsoft.VC90.CRT
bin\x86\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest
bin\x86\Microsoft.VC90.CRT\msvcr90.dll

Connecting to Database programmatically from C#

Connection string
<add name="compactCEdb1" connectionString="Data Source=|DataDirectory|\Database1.sdf" providerName="System.Data.SqlServerCe.4.0"/>

string conString = System.Configuration.ConfigurationManager.ConnectionStrings["compactCEdb1"].ConnectionString;
 string commandString = "Select empId from employee";
SqlCeConnection conn = new SqlCeConnection(conString);

            try
            {
                conn.Open();
                SqlCeCommand cmd = new SqlCeCommand(commandString, conn);
                string empId = cmd.ExecuteScalar().ToString();               
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
           
           




1 comment:

  1. Your Affiliate Money Printing Machine is ready -

    Plus, earning money online using it is as simple as 1---2---3!

    Here's how it all works...

    STEP 1. Choose affiliate products the system will push
    STEP 2. Add PUSH BUTTON TRAFFIC (it LITERALLY takes 2 minutes)
    STEP 3. See how the affiliate products system grow your list and up-sell your affiliate products all for you!

    So, do you want to start making money???

    Click here to launch the system

    ReplyDelete

AZ-104

Microsoft Azure is huge and it has hundreds of services underneath its umbrella It's actually going to be quite difficult to comprehend ...