How can i connect a html page to a Microsoft SQL Server?

flvtvl50  于 2023-03-07  发布在  SQL Server
关注(0)|答案(2)|浏览(215)

I am currently working on a html web page that is supposed to visualize the data (with tables, charts, graphs...) saved in a SQL database which lies on a local Microsoft SQL Server 2014.

Is there a common practise to connect the web page to this server? I stumbled upon node.js and ajax, but i could not manage to find a proper way to get the data out of the database.

I'm completely new to this topic since i never had to back up a webpage dynamically by connecting to a database so please take me there in baby steps :)

So far, i'm using nothing else but jQuery.

Thank you in advance!

lyr7nygr

lyr7nygr1#

The most basic way is to install XAMPP on your server. On it's official site there are manuals to installing and configuring it.

To connect PHP to SQL Server your will need to install proper drivers (check PHP version, x64/x86 etc on 'details' part of page).

Basic info how to connect to SQL Server you can find on web or, for example, here to connect via PDO, and here to connect via SQLSRV.

After on installations and configuring is done - you need to create PHP page that will take data from SQL Server and show it to user in proper way.

EDIT

I forgot about SSRS (SQL Server Reporting Services)! Here is an old good guide how to use it.

oalqel3c

oalqel3c2#

"Hi, you can do this by creating a DSN using ODBC Data Source:

  1. In the Visual Studio IDE, right click on ""Data Connections"" in the Server Explorer
  2. When ""Add Connection""opens, browse for the server from which the data to be pulled from and displayed.
  3. Now open the ODBC Source Administrator: Start | All Programs | Control Panel |Administrative Tools | Data Sources(ODBC)
  4. Select the DSN tab and click ""Add"". In the ""Create New Data Source"" window, scroll down to SQL Server Native Client 10.0
  5. Select the proper parameters and click ""Finish""
  6. Now open Visual Studio IDE and drag a Gridview control from the tool.
  7. Click ""New data source"" from the grid and select the database from the template
  8. Click ""New connection"" and select Microsoft ODBC Data source. Browse to the newly created DSN. 
  9. By assigning proper binding column to the grid the data can be displayed in the html grid. "

相关问题