Avançar para o conteúdo principal

Mensagens

A mostrar mensagens de 2015

Saving pictures to an Access database

What is the best method for storing images in a server? That's a discussion that we will never see the end. In my opinion, has in everything in life, it depends. But in this post we will not contribute to that dilemma. The objective of this post is to show how to store the pictures in an Access database. We start by creating a new project in VS 2013. Next, we create a class that will manage the database. In this class we will need a reference to a DLL that is responsible for creating the database file. In the Reference Manager with search in the COM section.    Back in the class with add a namespace: using ADOX; Now let's add three properties to the class: the path to the database file, a connection string and an object to make the connection with the database. class BaseDados     {         string caminhoBD;         string strLigacao;         OleDbConnection ligacaoBD;     }  The connection object needs another namespace: using System.Data.OleDb; In the constructor of the class

C# Web Service

After the last post on PHP web service now we develop a web service with Visual Studio 2013 in C#. Let's start by creating a ASP.NET project. In the next screen wee choose an Empty application. Now in we add a new item to our project. And next choose Web Service By now the Visual Studio have created the basic structure of our web service with one method called HelloWorld as an example. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace WebApplication2 {     /// <summary>     /// Summary description for WebService1     /// </summary>     [WebService(Namespace = "http://tempuri.org/")]     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]     [System.ComponentModel.ToolboxItem(false)]     // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.     // [System.Web.Script.Services.ScriptService]     public class WebService1 : System.We

PHP Web Service

In this post we will be developing a web service with PHP. The data is in a MySQL database and the output format is optional between XML and JSON. In order to collect the data we will be using MySQLi. The service won't be requiring any credentials and there won't be any limits to the number of requests although in some cases it would be necessary to consider that possiblities. First we must define the values needed to connect with the MySQL server. <?php $server = "server" ; $user = "userid" ; $password = "userpassword" ; $database = "database" ; ?> Next is the code that implements de service per say. <?php require "config.php" ; //connect to the database server $ligacao = new mysqli ( $server , $user , $password , $database ); //check connection if ( $ligacao -> connect_error ) die ( "Error connecting: " . $ligacao -> connect_error ); //options

Consuming a web service

In this post we will be talking about on how to consume a web service with a desktop application developed with C#. A web service is an API that is available through the internet and it can be used within the rules established. Some services are free and don't require identification others have to be payed or have some limitations on the number of calls or data produced. To demonstrate this concept we will be using a free service that the European Central Bank maintains in the following url http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml . This service returns the Euro currency rate over other countries currencies. This information is encapsulated in XML. Since we are making a desktop app we have to keep in mind the responsiveness of the user interface (GUI). So the request of the data must not occur in the main thread of the application which could block the GUI during the wait that is associated with exchange of information through the internet. The main code is this: asyn