I have two methods. First I pass one string from first method while calling the second method. In second method I do the calculations.
Now I want to pass the result back to the first method.
How do I achieve that?
My code is something like this:
private void RegisterButton_Click(object sender, RoutedEventArgs e)
{
string databaseName = "databaseName";
CheckDatabase(databaseName);
bool test = bRet;
}
private bool CheckDatabase(string databaseName)
{
string connString = "Server=localhost\\SQLEXPRESS;Integrated Security=SSPI;database=master";
string cmdText = "select * from master.dbo.sysdatabases where name=\'" + databaseName + "\'";
bool bRet = false;
using (SqlConnection sqlConnection = new SqlConnection(connString))
{
sqlConnection.Open();
using (SqlCommand sqlCmd = new SqlCommand(cmdText, sqlConnection))
{
int nRet = sqlCmd.ExecuteNonQuery();
if (nRet <= 0)
{
bRet = false;
}
else
{
bRet = true;
}
}
}
return bRet;
}
How do I pass back the bRet ??