 |
|
 |
This worked fine for MS SQL express!!!
|
|
|
|
 |
|
 |
Man!! I've been looking for info on how to use Stored Procedures with MFC.... thank you very much! Your utilitye helped me understand SP with MFC...thanks!! As the other people said.. "You're the man!! , keep it up!"
I agree!! One suggestion a tutorial on OBDC and MFC would be awesome!!
|
|
|
|
 |
|
 |
Worked straight away. Great!
|
|
|
|
 |
|
 |
Following the instructions I tried to execute the procedure before generating the class files. I get the following error because I wasn't able to give the input value for @key.
"Procedure GetData expects a parameter @key which was not supplied."
How do I execute a procedure to get the result set columns?
I'm using Sybase. Driver: syodase.dll version 04.20.0014 and odbc version 03.52.0000
Thank you!
|
|
|
|
 |
|
 |
Hi i am using Sql Server 2005 express edition.
I want to fetch the data from table in a gridview control and the column name from table2.
Accordning to me there are two ways for these:
1. Using Alias:
select fldID as "FieldID", field1 as (select fldname from table2 where Table1.fldID=Table2.fldID), field2 as "Fld2" from Table1 where fldID=1
2. Dynamically changing the column name of GridView.
I do not know about the second method.
I have also problem in the first method.
Please send me solution imediataly.
Naresh patel B.E. I.T
|
|
|
|
 |
|
 |
I have used this package to create a bunch of classes, but a couple of my stored procedures simply won't work.
I receive the following error message when I try to create a class for the SP appearing below the error.
Any suggestions from anyone would be appreciated. (Maybe there is an updated version?)
Error message:
Expected error 16 from application Stored Procedure Class Wizard............
Stored Procedure
CREATE PROCEDURE dbo.procDeleteDoctorInformation
@lReturnCode int OUTPUT, /* Return Code Value */
@lDoctorIDNumber int OUTPUT, /* Doctor Identifier */
@lDoctorPatientCount int OUTPUT /* Doctor Patient Counter */
AS
/*sp_Audit_Agent Setup Begin */
DECLARE @ErrorNo int
,@Procedure_Name varchar(30)
,@ErrorFlag int
,@ErrorMsg varchar(255)
,@RowCount int
/* Set the procedure name in the variable. */
SELECT @Procedure_Name = OBJECT_NAME (@@PROCID)
/* Set the @ErrorFlag variable to -1 as the default return value. */
SELECT @ErrorFlag = -1
/*sp_Audit_Agent Setup End*/
SELECT @lDoctorPatientCount = COUNT(Clinic.dbo.tblPatientBiographical.lPatientIDNumber)
FROM Clinic.dbo.tblPatientBiographical
WHERE tblPatientBiographical.lDoctorIDNumber = @lDoctorIDNumber
SELECT @ErrorNo = @@ERROR, @RowCount = @@ROWCOUNT
IF @ErrorNo <> 0
BEGIN
Select @ErrorMsg = 'SELECT Error,procDeleteDoctorInformation'
EXEC sp_Audit_Agent @UnexpectedError = 0, @Code = 16, @Text = @ErrorMsg, @Component = 'StoredProcedure', @Module = @Procedure_Name
RAISERROR('Cannot retrieve the Patient Count for the Doctor.',16,1)
SELECT @lReturnCode = -1
RETURN(@ErrorNo)
END
IF @lDoctorPatientCount <> 0
BEGIN
Select @ErrorMsg = 'SELECT Error,procDeleteDoctorInformation'
EXEC sp_Audit_Agent @UnexpectedError = 0, @Code = 16, @Text = @ErrorMsg, @Component = 'StoredProcedure', @Module = @Procedure_Name
RAISERROR('The Patient Count for this Doctor is NOT Zero, so we cannot delete.',16,1)
SELECT @lReturnCode = -2
RETURN(@ErrorNo)
END
DELETE FROM Clinic.dbo.tblDoctor
WHERE tblDoctor.lDoctorIDNumber = @lDoctorIDNumber;
SELECT @ErrorNo = @@ERROR, @RowCount = @@ROWCOUNT
/* PRINT 'After DELETE Based on Doctor ID @ErrorNo = ' + ltrim(str(@ErrorNo)) + ' @RowCount = ' + ltrim(str(@RowCount)) */
IF @RowCount > 0
SELECT @ErrorFlag = 0
ELSE
BEGIN
Select @ErrorMsg = 'SELECT Error,procDeleteDoctorInformation'
EXEC sp_Audit_Agent @UnexpectedError = 0, @Code = 16, @Text = @ErrorMsg, @Component = 'StoredProcedure', @Module = @Procedure_Name
RAISERROR('Cannot Delete the Doctor Information.',16,1)
SELECT @ErrorFlag = -3
END
SELECT @lReturnCode = @ErrorFlag
RETURN(@ErrorNo)
GO
Thanks for any and all responses.
|
|
|
|
 |
|
 |
Yes, you are correct!! With selective changes here and there, you can pretty much convert this to apply to ANY database.
You're the man, dude!! You are the MAN!!
(How else can anyone not vote a '5' for this?)
William
Fortes in fide et opere!
|
|
|
|
 |
|
 |
I would like to Insert the data into my table using the stored procedure,I have already created the stored procedure but now I do'nt know how to run it using the coding,can som one please provide me with sample
|
|
|
|
 |
|
 |
Thank you very much for this incredible wizard.
--
Maximiliano Bertacchini
|
|
|
|
 |
|
 |
its helps in creating stored procedure
|
|
|
|
 |
|
 |
Bless you and your family and your kids and any pets you may have. You saved me tons of time!!!
|
|
|
|
 |
|
 |
Thanks for great contribution. But how do I use the same in my MFC code. How to open and pass input parameter and then get results.
|
|
|
|
 |
|
 |
prashmit
Did you ever get a response from this? I am in the same situation where I am lacking the understanding on how to implement the use of the produced Class. It gives me errors when I run, and I'm sure it's my fault.
- KDS
|
|
|
|
 |
|
 |
CDatabase db1;
s1.Format("ODBC;UID=sa;PWD=%s","");
db1.Open("report",false,false,s1);
//chcode is a recordset object
chcode chrs(&db1);
//set procedure parameter value
chrs.m_email="qingshanyin@hotmail.com";
if(chrs.ExecDirect())
{
while(!chrs.IsEOF())
{
//your code
chrs.MoveNext();
}
}
琴心剑胆,义薄云天。
|
|
|
|
 |
|
 |
You are good man!
Thanks
http://www.ucancode.net/
|
|
|
|
 |
|
 |
Thank you! This utility saved me hours of work!
Just one suggestion, create a demo for those new to ODBC and C++.
|
|
|
|
 |
|
 |
Good Evening,
I get this error when trying to send a BLOB (CLongBinary) as a param. Below is the MFC breakpoint.
#ifdef _DEBUG
case CFieldExchange::BindParam:
// CLongBinary parameters are not supported
ASSERT(FALSE);
This has been the only real problem with this awesome tool!
Scott1
|
|
|
|
 |
|
 |
Hello,
This class generator for CRecordset-based classes is very useful for set of records but I am not sure how can I use these generated classes for getting input or/and output parameters?
May you help me relating to that?
Regards,
Tesic Goran
|
|
|
|
 |
|
 |
Good Evening, I have been trying to work with a stored procedure for hours. I couldn't find help in MSDN for return value codes in C++. I found and used this tool, and understand where my errors were, and now have a tool to save time working with every stored procedure I create in the future. It works great! I
Thank you so much!!
Scott!
|
|
|
|
 |
|
 |
This tool realy help me a lot to shorton my application development time...Nice job.
|
|
|
|
 |