W
weird0
localhost.BankingService bservice = new localhost.BankingService();
int
balance=Convert.ToInt32(bservice.CheckBalance(InfoAccount.pincode)); //
Line of Error
How can i remove this error?
I get the error above. Here are the definitions for the functions
CheckBalance() and SearchDatabase().
[WebMethod]
public string CheckBalance(string pincode)
{
string Balance = "";
string pinCode = pincode.ToString();
// create a Command,Connection and Reader object
if (SearchDatabase(Convert.ToInt32(pinCode))>0)
{
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(connectionString);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand();
Object returnValue;
// Search for the pincode
cmd.CommandText = "SELECT acc_balance as SqlBalance FROM
Account_Information where pincode_atm='" + pincode + "'";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
returnValue = cmd.ExecuteScalar();
Balance=returnValue.ToString();
sqlConnection1.Close();
}
return Balance;
}
[WebMethod]
public int SearchDatabase(int pincode)
{
int RowCount = 0;
// create a Command,Connection and Reader object
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(connectionString);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand();
SqlDataReader reader;
// Search for the pincode
cmd.CommandText = "SELECT pincode_atm FROM Account_Information
where pincode_atm='" + pincode.ToString() + "';";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
reader = cmd.ExecuteReader();
// Loop through and find the number of rows
while (reader.Read())
{
RowCount++;
}
reader.Close();
sqlConnection1.Close();
return RowCount;
}
int
balance=Convert.ToInt32(bservice.CheckBalance(InfoAccount.pincode)); //
Line of Error
How can i remove this error?
I get the error above. Here are the definitions for the functions
CheckBalance() and SearchDatabase().
[WebMethod]
public string CheckBalance(string pincode)
{
string Balance = "";
string pinCode = pincode.ToString();
// create a Command,Connection and Reader object
if (SearchDatabase(Convert.ToInt32(pinCode))>0)
{
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(connectionString);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand();
Object returnValue;
// Search for the pincode
cmd.CommandText = "SELECT acc_balance as SqlBalance FROM
Account_Information where pincode_atm='" + pincode + "'";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
returnValue = cmd.ExecuteScalar();
Balance=returnValue.ToString();
sqlConnection1.Close();
}
return Balance;
}
[WebMethod]
public int SearchDatabase(int pincode)
{
int RowCount = 0;
// create a Command,Connection and Reader object
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection(connectionString);
System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand();
SqlDataReader reader;
// Search for the pincode
cmd.CommandText = "SELECT pincode_atm FROM Account_Information
where pincode_atm='" + pincode.ToString() + "';";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
reader = cmd.ExecuteReader();
// Loop through and find the number of rows
while (reader.Read())
{
RowCount++;
}
reader.Close();
sqlConnection1.Close();
return RowCount;
}