Solved

invalid object name 'dbo.pSupervisorCheck_EOL'

Posted on 2011-02-14
6
589 Views
Last Modified: 2012-05-11
Working on a program "Supervisor" written in MFC on MS Visual c++ 2005 , the program is used to log in with supervisor user name and password, then adjust the "SoftVer"data in SQL SERVER 2005.
The following code is my ADO database connection part. and attached the SQL server image and error msg image.
_ConnectionPtr pConnection = NULL;
	_CommandPtr cmmd = NULL;
	_ParameterPtr param = NULL;
	_RecordsetPtr pRs = NULL;

	HRESULT  hr= S_OK;
	_bstr_t  strCnn(_T("Provider=sqloledb; Network Library=DBMSSOCN; Data Source=555.55.555.55,1433; Initial Catalog=Central_DB; User Id='"+strRegName+"'; Password='"+strPWD+"';")); 
	
	try
	{
		TESTHR(pConnection.CreateInstance(__uuidof(Connection)));   
		hr = pConnection->Open(strCnn,"","",NULL);   
		(cmmd.CreateInstance(__uuidof(Command)));	
		

		param = cmmd->CreateParameter(_T("")/*UserName*/,adVarChar,adParamInput,strUserName.GetLength()+1,_variant_t(strUserName));   
		cmmd->Parameters->Append(param);   
		param = cmmd->CreateParameter(_T("")/*LoginPWD*/,adVarChar,adParamInput,strLoginPWD.GetLength()+1,_variant_t(strLoginPWD));   
		cmmd->Parameters->Append(param);   
		param = cmmd->CreateParameter(_T("")/*FactoryID*/,adVarChar, adParamInput,strFactoryID.GetLength()+1,_variant_t(strFactoryID));     
		cmmd->Parameters->Append(param);   
		param = cmmd->CreateParameter(_T("")/*LineID*/,adVarChar,adParamInput,strLineID.GetLength()+1,_variant_t(strLineID));   
		cmmd->Parameters->Append(param);
		//Return para
		param = cmmd->CreateParameter(_T("Result")/*Result*/,adVarChar, adParamOutput,50,_variant_t(strResult)); 
		cmmd->Parameters->Append(param);
		param = cmmd->CreateParameter(_T("Year")/*Year*/,adVarChar,adParamOutput,50,_variant_t(strYear));   
		cmmd->Parameters->Append(param);
		param = cmmd->CreateParameter(_T("Model")/*Model*/,adVarChar,adParamOutput,50,_variant_t(strUBMModel));   
		cmmd->Parameters->Append(param);
		param = cmmd->CreateParameter(_T("Material")/*Material*/,adVarChar,adParamOutput,50,_variant_t(strMaterial));   
		cmmd->Parameters->Append(param);
		param = cmmd->CreateParameter(_T("SoftwareVer")/*SoftVer*/,adVarChar,adParamOutput,50,_variant_t(strSoftVer));   
		cmmd->Parameters->Append(param);
		param = cmmd->CreateParameter(_T("CalibrationVer")/*CalVer*/,adVarChar,adParamOutput,50,_variant_t(strCalVer));   
		cmmd->Parameters->Append(param);		
		
		cmmd->CommandText=_bstr_t(_T("pLoginCheck_EOL"));   
		cmmd->ActiveConnection = pConnection;  
		cmmd->CommandType=adCmdStoredProc;     
	     
		cmmd->Execute(NULL,   NULL,   adCmdStoredProc);  

		strResult=cmmd->Parameters->GetItem(_T("Result"))->GetValue();     	
		
		
		if (strResult==_T("Fail"))
		{
			cmmd.Detach(); 
			GetDlgItem(IDC_Status)->SetWindowTextA(_T("Error:Login Fail!"));
			m_lbStatus.SetTextColor(RGB(255,0,0));
			return;
		}
		else
		{
			GetDlgItem(IDC_Status)->SetWindowTextA(_T("Login Success!"));
			strYear=cmmd->Parameters->GetItem(_T("Year"))->GetValue();
			strUBMModel=cmmd->Parameters->GetItem(_T("Model"))->GetValue();
			strMaterial=cmmd->Parameters->GetItem(_T("Material"))->GetValue();
			strSoftVer=cmmd->Parameters->GetItem(_T("SoftwareVer"))->GetValue();
			strCalVer=cmmd->Parameters->GetItem(_T("CalibrationVer"))->GetValue();
			cmmd.Detach();  

		}

Open in new window


sql procedure image error message
0
Comment
Question by:snowycanada
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 7

Expert Comment

by:lundnak
ID: 34892175
Does your userid have execute privileges on the stored procedure?
0
 

Author Comment

by:snowycanada
ID: 34894442
In database user "Steven"->propertiies->securable, It's blank.
I tried to add the procedure in the securable and give all the permission, but the problem is still.
0
 
LVL 7

Expert Comment

by:lundnak
ID: 34896694
I'm curious to find out if you are actually connecting to the SQL Server instance as that user id.
Would you be able to put a wait or sleep call in your code (wait minute or so) right before you execute the stored procedure?  Then open SQL Server management studio and run "exec sp_who2" in a SQL window in order to see what sessions are active and what the logins are.

0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

Author Comment

by:snowycanada
ID: 34897395
Did as Lundnak's suggestion. One more question: Why is still TODO <PRODUCT NAME> ?THE RESULT OF SP_WHO2
0
 

Author Comment

by:snowycanada
ID: 34899201
Hi Lundnak,
the error msg "invalid object message" is replaced by "Type mismatch", after I create a new procedure pSupCheck, and I copied the old procedure code into new one. The procedure looks like working, but why it coms out the error message mismatch? I delete all the code in new procedure, it still mismatch. Is it because some setting error?
0
 
LVL 7

Accepted Solution

by:
lundnak earned 500 total points
ID: 34899534
I noticed that the parameter fields for the sproc are Nvarchar, but in your code you are using adVarChar.  That is likely the issue.  You need to change one or the other.  
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question