SQL Azure - Executing Stored Procedure



Executing a Stored Procedure using SQL Azure

using Sytem.Data;
using System.Data.SqlClient;
protected void Page_Load(object sender, EventArgs e)
    {
//stoaxy9 - unique server that is generated automatically for your account. Make trusted connection to false. 
string sConn = "Server=tcp:stoaxy9.database.windows.net;
Database=TestDB;User ID=dons;
			Password=mypassword;Trusted_Connection=False";

        SqlConnection objConn = new SqlConnection(sConn);
        objConn.Open();

        SqlCommand objCmd = new SqlCommand("dbo.GetNames", objConn);
        objCmd.CommandType = System.Data.CommandType.StoredProcedure;

        myGridView.DataSource = objCmd.ExecuteReader();
        myGridView.DataBind();

        objConn.Close();
    }

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.