locked
connection string RRS feed

  • Question

  • User-354723898 posted

    From within WebMatrix I have built a database with an .sdf file type, and have created a simple table within that database. The connection string from web.config is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.data>
            <DbProviderFactories>
                <remove invariant="System.Data.SqlServerCe.4.0" />
                <add invariant="System.Data.SqlServerCe.4.0" name="Microsoft® SQL Server® Compact 4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
            </DbProviderFactories>
        </system.data>
    </configuration>

    I would like to know how to code this connection string and retrieve data using PHP (or perhaps another type of coding) within my HTML file.

    Can anybody get me going with this?

    Humbled
    Monday, April 11, 2016 11:16 PM

Answers

  • User-646145796 posted

    Hi,

    There are two questions: 1) how to use sql ce via php 2) how to deploy php application to Azure web app.

    >1) how to use sql ce via php

    For this question, please refer to http://stackoverflow.com/questions/168240/is-it-possible-to-connect-php-to-sql-server-compact-edition for more details.  there is no native driver to connect PHP to SQL Server Compact Edition. If you want to connect to it, your best bet is to use PHP ODBC connections to talk to a ODBC Driver connected to the SQL Compact server. If possible I would suggest you use MySQL or SQL database instead.

    >2) how to deploy php application to Azure web app.

    If you want to deploy application to Azure web app via Webmatrix, please refer to this article: https://blogs.msdn.microsoft.com/devschool/2015/07/01/azure-post-a-php-app-and-mysql-database-to-azure/. In this article it choose MySQL as the databse, but we can use the same steps to deploy application to azure. If you use Sql database file, after published, please check the database file in Azure web app server.

    Best Regards,

    Jambor

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 12, 2016 2:19 AM