|
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.
|
|
|
|
|
I have simple udp client and server using UdpClient class in .net frame work 2.0
My Ip address is 192.168.5.20
and client ip address is 192.168.1.25
When i tried to send udp packet from client to server exception occurs: "A socket operation was attempted to an unreachale host 192.168.5.20:10080"
But when i change my(server) IP address to "192.168.1.20" communication is fine.
How i can solve this problem or,how i can send packets other than my domains ip addresses.
Paul Dave.
|
|
|
|
|
if you have an address of 192.168.5.x, and another address of 192.168.1.x, then you need a device like a router that knows how to transfer (route) data between the subnets
(or possibly a switch), I forget which
[edit] this link shows a bit about it [/edit] http://www.firewall.cx/ip-subnetting-routing.php[^]
The picture right down the bottom is more what I was thinking - it might be impractical to do this at home - so why not use just 192.168.5.x where x can be any port except 'well known' port(s)
'g'
modified on Monday, June 8, 2009 4:09 AM
|
|
|
|
|
Thanks, for your reply
I forget to tell you that both my pc and client pc are on same network, through a switch already.
matter is that ip addresses are fixed (where i have to launch application).server address is 192.168.1.25 and one of client is having 192.168.5.20 is there any software method to solve it...?
|
|
|
|
|
plowgrammer2010 wrote: is there any software method to solve it...?
I doubt it - unless you have a smart switch that works as a router, you'll have to give the client an address on the 192.168.1 subnet - this sort of thing is handled at a lower level than 'your' software
'g'
|
|
|
|
|
hi
in my project i have a small requirement
i have a combobox in that i have items
1)Ms office 2003
2)Ms office 2007
these items are added manually
if i select "Ms office 2003"
then the corresponding Ms office word document should be opened
if i select "Ms office 2007"
then a word document of version 2007 should be opened
similarly i have a another combobox in which i have items
1)Autocad 2004
2)Autocad 2006
3)Autocad 2008
4)Autocad 2009
when i select a item then the corresponding application should be opened
these items are of "Auto cad Application" with different version
with regards
vijay kumar d
|
|
|
|
|
I guess this assumes the versions of Workd and Autocad are already there. Your best bet would be to run the right executable and passing in the document path as a parameter, rather than just executing the document and letting windows decide what program is registered to handle it.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|