Monday, September 12, 2011

ServiceRefrence_ClientConfig

<configuration>

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMobileUtilities" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://utopiapimp.com/services/MobileUtilities.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMobileUtilities"
contract="PimpMobileService.IMobileUtilities" name="BasicHttpBinding_IMobileUtilities" />
</client>
</system.serviceModel>
</configuration>

Friday, May 6, 2011

direct database connect

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Data;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string name = txtName.Text;
int age = Convert.ToInt32(txtage.Text);
double number = Convert.ToDouble(txtNumber.Text);
string sex = Convert.ToString(ddlSex.SelectedItem);

string a = System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ToString();
//string connectionstring = WebConfigurationManager.ConnectionStrings["myconnection"].ConnectionString;
SqlConnection con = new SqlConnection(a);
if (con.State != ConnectionState.Open)
con.Open();
string query = "insert into tblPersonalDetails(name,age,sex,number) values('" + name + "','" + age + "','" + sex + "','" + number + "');";
SqlCommand cmd = new SqlCommand(query, con);
int i = cmd.ExecuteNonQuery();
con.Close();
if (i > 0)
{
lblmessage.Text = "success";
}
else
{
lblmessage.Text = "failed";
}


}
protected void btnView_Click(object sender, EventArgs e)
{
string CommandString = "select * from tblPersonalDetails where name = '"+txtName.Text + "';";
string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ToString();
SqlConnection con = new SqlConnection(connectionstring);
if (con.State != ConnectionState.Open)
con.Open();

SqlCommand cmd = new SqlCommand(CommandString, con);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
grdview.DataSource = ds;
grdview.DataBind();
}

protected bool GetLoginInfo(string Username, string password)
{
bool result = false;
try
{
string CommandString = "SELECT COUNT(id) as total from tblLoginInfo where username = '" + Username + "' and password = '" + password + "';";
string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ToString();
SqlConnection con = new SqlConnection(connectionstring);
if (con.State != ConnectionState.Open)
con.Open();

SqlCommand cmd = new SqlCommand(CommandString, con);
SqlDataReader sdr = cmd.ExecuteReader();
int Total = 0;
while (sdr.Read())
{
Total = Convert.ToInt32(sdr["total"].ToString());
}
con.Close();
if (Total > 0)
result = true;

}
catch { }

return result;
}
}

Friday, February 4, 2011

First Week at EB Pearls

Last week was my first week in the EB Pearls. Throughout this week, me and my friend Roshan didn't have any major work to do. Week went just doing some testing and former practices. Today is the last office day of this week. I wish in the coming week, some important task comes in our hand to do. Looking forward for the coming week.

Tuesday, November 30, 2010

today I was lost for sometime. I thought about my future and I didnt get any idea. Sometine I think I would do something in software field and sometime the field of networking is also better. But I think the software field would be the better one because its keep on changing daily which creates eagerness to do something so that everyone can recognize me and my work.

Wednesday, November 24, 2010

the four year of computer engineering will end within a month. this journey of four years has been tremendous for me. I learnt so many things during this period. I saw so many ups and down within my self. I feel my self polished in these years. Not only academic ways but I find my self much improved socially too. I would like to thank all my teachers and friends for all the support during these years. I will miss my college days. "purani jeans" tetikai hit bhako hoina bhanne kura aaja feel hundai cha. Its the reality.