Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function reference problem

Status
Not open for further replies.

dushkin

Programmer
Mar 28, 2002
90
0
0
US
Hi. I tried this in SQL and nobody could figure it out. I am stuck on a sql/logic problem. No matter what i do i get the same error - waiting for another function to complete. the database is working fine and i still get the same error. When i try to print to a messagebox, it breaks at the same point... wherever there is comm.ExecuteScalar(); I have printed the code below. The error message i get next to the first comm.ExecuteScalar is:

"this code has called into another function. when that function is finnished, this is the next statement that will be executed".

here is the code...

Code:
private void bLogin_Click(object sender,System.EventArgs e)
{
        
const string connStr = "data source= FUGUE\\NETSDK;" +
 "Initial Catalog = office_DB;" + "User ID = sa;" +"Password =tomatito";            
//hashPassword = HashString(tbPassword.Text);
SqlConnection conn = new SqlConnection(connStr);
string sql = "SELECT Email_Addr FROM Employees WHERE Email_Addr ='" +cbEmail.Text + "' AND Password ='"+ tbPassword +"'";
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
//if there is a match

if(comm.ExecuteScalar() != null)
{

//minimize the signin form        
SignInForm s = new SignInForm();
s.WindowState = System.Windows.Forms.FormWindowState.Minimized;
            
//And close this login form
this.Close();

//And open the SM GUI
Gui gui = new Gui();
gui.Show();
                    
}
            
errorProvider.SetError(bLogin, ErrMsg);
MessageBox.Show("You are not in our database. Try again, register, or cancel.");
                
conn.Close();
conn.Dispose();
        
}
}
 
can you tell me how to do that? every time i try to messagebox.show or write to a console it breaks at the same point comm.executescalar. i am not able to see
error output unless i mouse over code during debug.
 
Hmmm...maybe try and go

Comm.Connection.open

instead of openting the connection explicitly (not sure if that's it, but worth a try...)

D
 
Code:
string sql = "SELECT Email_Addr FROM Employees WHERE Email_Addr ='" + 
cbEmail.Text + "' AND Password ='"+ tbPassword +"'";
// here:
System.out.println (sql);
SqlCommand comm = new SqlCommand(sql, conn);

seeking a job as java-programmer in Berlin:
 
hi. thanks, but all that does is print out the sql line directly above it. the problem i have is with comm.ExecuteScalar... it breaks and says it is waiting for another function to end. I am not sure how to error check that break. thanks again...
 
im using VB.NET 2005 and im getting that too but not as an error, its called "call return" - and when i run my program it goes into the debugger and highlights a line of code green.

if i find out how to fix/or something il post here.
 
I asked for the sql-string, because they sometimes don't look as expected.
At least you could try the statement in a sql-box.

In general, that's very much a VB.NET question - isn't it?

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top