|
Friends,
How do I get the number of records in a OleDbDataReader ?
How do we move to the first record, if we reach the last record ?
<br />
OleDbCommand cmd = new OleDbCommand( "select description from test", conn );<br />
OleDbDataReader odr=cmd.ExecuteReader(CommandBehavior.CloseConnection);<br />
Smitha
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
|
Thanks Nish. So I got to do an extra query
BTW, Are you still doing C# ?
Smitha
If you can smile when things go wrong, you have someone in mind to blame
|
|
|
|
|
|
I am not all that familiar with this DataReader problem and if I understand the problem correctly, you need to know how many items are in the result set before you process them and you wish to do this with only one query to the server. If your db provider supports multiple results sets you can execute one query such as:
SELECT COUNT(*) as CNT FROM MyTable
SELECT * FROM MyTable
Then in your code you would read the count from the first result and once you have the count, simply use the OleDbDataReader.NextResults member to switch to next result set which is you main query. This is one call to the server and in most cases will have little performance penalty.
Rocky Moore
|
|
|
|
|
How can I create Windows Installer setup package for my C# application if this option is not available/not working n my VS? are there any other FREE solutions?
Many Thanks,
jassim Rahma
Jassim
|
|
|
|
|
Hi Jassim
You could try Inno Setup which is free. But you'll have to distribute the .NET runtime and stuff like that on your own (unlike the VS installer, Inno wont automatically find and add dependencies for you - you gotta add them to the setup yourselves)
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Nishant S wrote:
unlike the VS installer
Even the VS.NET installer requires you to ship the framework separately. Currently it just throws up a Message Box with a message informing the user that they need the framework to install the program (the message is customizable)
There is a bootstrapper sample on MSDN that is supposed to detect/install the framework if needed, but I couldn't get it to work/compile.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
James T. Johnson wrote:
There is a bootstrapper sample on MSDN that is supposed to detect/install the framework if needed, but I couldn't get it to work/compile.
You've also got a merge module (.msm) to play with.
The cmdline with dotnetfx.exe has many options to check against the possibly existing run-time.
|
|
|
|
|
.S.Rod. wrote:
You've also got a merge module (.msm) to play with.
Yes, but if you include the merge module it will fail to build.
"ERROR: dotNETFXRedist_x86_enu.msm must not be used to redistribute the .NET Framework. Please exclude this merge module."
For some unknown reason MS decided they wouldn't let you include it in a setup project. I would think that defeats the purpose of having it in the first place; perhaps its for detected dependencies (mscorlib, etc).
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I have this function exported in a Windows API DLL written in C:
TESTECS_API int fnTeste(char* pOutput)
{
char buffer[] = "0000MENSAGEM DE TESTE ";
memcpy(pOutput, buffer, sizeof(buffer));
return 0;
}
I need to call this function from a managed C# code, passing a structure as the char* parameter. The parameter cosists of a set of strings, each one representing a piece of that BIG string that is being copied to the strucutre in the unmanaged DLL.
Here is how I defined the code to call the DLL in managed code:
[StructLayout(LayoutKind.Sequential , CharSet=CharSet.Ansi)]
public struct Resposta {
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=2)] public String FIELD1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=2)] public String FIELD2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)] public String Mensagem;
}
public class Win32API {
[DllImport("testecs.Dll")]
public static extern void fnTeste( ref Resposta r);
}
public class App
{
public static void Main()
{
Resposta r = new Resposta();
Win32API.fnTeste(ref r);
Console.WriteLine(r.FIELD1);
Console.WriteLine(r.FIELD2);
Console.WriteLine(r.Mensagem);
}
}
The result that comes out of this program is:
0
0
MENSAGEM DE TESTE
The result I´m expeting is:
00
00
MENSAGEM DE TESTE
The problem is that the marshaller is putting an \0 in the end of each string of the strucutre, even if I state that is a ByValTStr and implicit tells its size. Does anyone know how to "automatically" remove te zero terminator during the marshalling process, so that I get the expected result ? Does anyone know any other method that I can use to solve this problem ?
thanks in advance
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
"Th@ langwagje is screwed! It has if's but no end if's!! Stupid php cant even do butuns on forms! VISHAUL BASICS ARE THE FUTSHURE!" - Simon Walton
|
|
|
|
|
|
Hi all,
is there any Grid Control free sources usable with C# for Windows CE ? Something like Dundas grid. As I might understand even DataGrid control is not supported under CE.NET in VS 7, so any info/links will be strongly appreciated.
Thanks in advance,
Alex Gusev
alex.gusev@retalix.com
|
|
|
|
|
Alex Gusev wrote:
As I might understand even DataGrid control is not supported under CE.NET in VS 7
Looking at the documentation included with the final beta of VS.NET 2003 the DataGrid lists the Compact Framework as a supported platform.
I know next to nothing about the .NET CF though so they could be meaning something else by that.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
May I ask you which build do you use?
I have VS.NET codename Everett Enterprise Architect
MS Development Environment 2003 beta Version 7.1.22.15 and
MS .NET Framework 1.1 Version 1.1.4322
That's what's written in About... box
Unfortunately DataGrid doesn't list .NET CF as supported platform
Alex Gusev
|
|
|
|
|
Alex Gusev wrote:
VS.NET codename Everett Enterprise Architect
MS Development Environment 2003 beta Version 7.1.22.15 and
MS .NET Framework 1.1 Version 1.1.4322
Microsoft Development Environment 2003 Beta Version 7.1.2292
Microsoft .NET Framework 1.1 Version 1.1.4322
At the bottom of all the .NET framework docs I have this disclaimer:
"Syntax based on .NET Framework version 1.1.4322.
November 15, 2002."
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
James T. Johnson wrote:
Syntax based on .NET Framework version 1.1.4322.
November 15, 2002."
Do they change syntax every 15 days...what a nightmare
Kannan
|
|
|
|
|
No. As far as I know nothing has changed syntax wise since the 1.1 changes were released back when it first came out in public beta (I want to say in October).
For the most part 1.1 is a ton of bug fixes and a few added features, most security wise.
The one that I that I wish was in 1.0 but isn't is a few tags in the configuration file schema. In 1.1 it only takes one tag to specify what version of the runtime you want to use. But for your 1.1 app to work on a 1.0 only system you need one section of tags for every core assembly your app references.
The configuration file can be generated by a wizard, so the job of creating it is easy; but I wouldn't entrust users to create the file themselves.
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I can see that two or three years from now, with multiple run-times, large systems can be affected with these kind of settings along with policy settings for individual applications etc, something equivalent of dll hell, although this is entirely a differnt beast. Its like while trying to solve one problem, we always end up with differnt kind of problem.
Kannan
|
|
|
|
|
:(dear all :
I'm a beginner.
Does anybody know of a simple way to disable tooltips on the fields in the preview window of a Crystal report ?
Vicky Cao
|
|
|
|
|
Can anybody tell me how can create a voice software just like IBM Via Voice in an Arabic language using C#?
Jassim Rahma
|
|
|
|
|
The closest I can think of is speech sdk[^] from MS
Hope this helps
Kannan
|
|
|
|
|
Do we have something like CreateProcessWithLogonW in .NET?I want to create process as another user.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Hi,
I'm just trying to build a custom control (composite). Say I've put a ListView on my custom control form. How can I forward for example the ItemCheck event so that a user of my control can actually write an event handler for it?
Is there a better (easier) way then defining a new delegate + event, etc.?
Thanks in advance!
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
I've been using the IE WebBrowser control in one of my apps, but I recently discovered that Mozilla has an ActiveX interface that matches IE's (http://www.iol.ie/~locka/mozilla/mozilla.htm).
Though, when I try to use aximp.exe on mozctlx.dll, it gives me an error. I managed to use it on mozctl.dll and import it into my app, but my app crashes if I try to use the Navigate() method.
Has anyone tried any of this?
|
|
|
|