|
Pete O'Hanlon wrote: you should post this in the database forum
It's a fantastic candidate for the "Coding Horrors" forum instead.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
you know the sp has lots of code than high level language
|
|
|
|
|
try to remove the next from from the code below and try again
open curMain
--local variables
declare @dblPer int, @divisor int, @intTotMonths int,@blnSzdStatus smallint
fetch next from curMain into @LdgAcNo , @MAcName , @FileNo , @MaxiInstlAmt , @MaxiMinInstlAmt , @DCPDt , @FClBal, @Ac_Status , @FileClosedDt , @ReconV , @GuestPrdComp , @TermComp , @FOID , @FOName , @DistName , @ZName , @Model , @Ac_StatusB , @BClosedDt , @SzdStatus , @SzdDate , @IntRt , @LoanAmt , @TotAmt
change it into fetch curMain into @LdgAcNo,....
|
|
|
|
|
I have tried it.
returns same message
mir
|
|
|
|
|
Be sure that the number of columns you are selecting in the select statement for the cursor is the same number of variables that you have when calling the Fetch
|
|
|
|
|
I have chacked it several times . Everything is fine . also the length for varchar types. the message not shown if I select into the first variable only. I don't know whats the problem with it . but I have wrote a lot of sp with such select into.
|
|
|
|
|
In the query you are building you have Select Distinct and when you are creating the cursor you have another SELECT. it can be that there is the problem. when it tis being executed you are havin
SELECT SELECT DISTINCT...
|
|
|
|
|
No change takes place.
Instead, would you please tell me the ways to open cursors excluding
Open cursor cursor_NAme for select_statement
I think as I provide the select_statement as a string variable , it may functioning another way
thanks for your time
br,
mir
|
|
|
|
|
mmdullah wrote: Everything is fine
No its not, otherwise you wouldn't be getting the error. The error TELLS you what is wrong, you need to double check it. At the end of the day, its right and you're wrong.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Would make a good entry for the Code Horrors forum.
|
|
|
|
|
The problem is here:
mmdullah wrote:
declare curMain cursor for select @strsql
the select statement selects a string not a result set!
no need to write all that code to generate the error, a simple script of 4/5 lines will do the trick!
regards
|
|
|
|
|
I'm not a T-SQL expert so I may be wrong here. On the other hand, if you want the opinion of database experts you should probably have posted this in the database forum.
I suspect that:
declare curMain cursor for select @strsql
will select the literal contents of the variable strsql. It seems to me that you will need to exec the strsql variable, or whatever the T-SQL equivalent is, in order to get it to run as an actual query.
Of course, if anyone from the database forum happens to be passing by and knows better than me, please feel free to correct me.
|
|
|
|
|
Why are you using a cursor for this? A cursor is a very inefficient way of manipulating data, and as far as I can see, all you are doing is returning data. Why not use a stored function to return this data?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
How can I use wscript in c# to return the result of the vbscript.
For example I have a vbscript file called test.vbs
This file contains:
wscript.echo 100
wscript.echo 200
In c#, I would like to run this file and return the two returned values i.e. 100 and 200
How can I do this please?
Thanks
|
|
|
|
|
I'm not 100% sure but I don't think you can
If you were using cscript you could just read from its standard output (untested, but it's supposed to work)
|
|
|
|
|
|
I am doing a small windows application using C# which connects to an MS Access Database. I am using OleDb via ADO to interact with the database. when I am trying to get the data from the database I'm being shown this error message
"Selected collating sequence not supported by the operating system."
I googled the problem but all the results that I have tried failed. Can someone help me about this please?
Thanks
|
|
|
|
|
Can you post the connection and selection code please? We may be able to help if we see the code that you using!!
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
This is the method that I am calling to get the data
public DataTable GetData(string fromDate, string toDate, string connectionString)
{
DataTable dt = new DataTable();
OleDbConnection con = new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand();
try
{
cmd.CommandText = String.Format("SELECT CHECKINOUT.CHECKTIME, CHECKINOUT.CHECKTYPE, USERINFO.TITLE FROM CHECKINOUT INNER JOIN USERINFO ON CHECKINOUT.USERID = USERINFO.USERID WHERE (((CHECKINOUT.CHECKTIME) Between #{0}# And #{1}#));", fromDate, toDate);
cmd.Connection = con;
con.Open();
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(cmd);
dataAdapter.Fill(dt);
}
catch (Exception ex)
{
throw ex;
dt = null;
}
finally { con.Close(); }
return dt;
}
|
|
|
|
|
Have a look at the following post[^]. Maybe this will give you some insight into a solution. I think it might be something to with the BETWEEN statement.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hello Experts!!
As we all know that we have to include a item number whenever i add in 1 item into the datagrid.
eg.
ItemNo Name Address
1. Mary Canada
2. John USA
i have included an Item no column in my datagrid but i dont know how can i make it work. i want to increment the item no by 1 everytime i add in a new record. but after when i exit the form and come back again. the item no will start at 1 again, it will not continue on with the last number. i will "reset" and start from 1 again. Hope someone will be able to help me!
Any doubts, you can clarify with me. hope i managed to explain what i want to do.
|
|
|
|
|
When you close the form the count is destroyed - normally the number is stored in the database. If you do not store it in a database you need to store it some where. There are a number of options, settings or a text file or a xml file even a registry item can be used.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Have you tried setting the item number as the Primarykey in the Table? This will then increase automatically everytime you add a new item.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
but i am adding data at a time means 10 records at a time.and save once.
|
|
|
|
|
Letting the Database Auto generate the number should resolve that problem. You can display this number when you refresh the Datagrid
Excellence is doing ordinary things extraordinarily well.
|
|
|
|