|
ExecuteReader is what you need. The returned value is a SqlDataReader. With this you can iterate through the rows. Simpler approach is to use a dataset with a dataadapter. This will read the rows within a table anyway.
But first you can use ExecuteReader, iterate through the rows and add the rows with values to your datatable.
|
|
|
|
|
I'll give it a try
thank you!
|
|
|
|
|
|
|
|
|
Hey... don't repost your question. You've got the answer. It's an attribute.
To know, what is an attribute, go to GOOGLE or MSDN. Learn first.
|
|
|
|
|
i m getting google results for attribute to a method.
i want to know what exactly is attribute when passed to method parameter.
Sorry for reposting, but plz explain.
Ravie Busie
Coding is my birth-right and bugs are part of feature my code has!
|
|
|
|
|
Its an attribute on the parameter, nothing is getting passed other than the parameter itself.
you can, by reflection find the parameter on the attribute to inspect its value.
The code you have is ,erm, unusual to say the least so I doubt you'll get much help over that you have already. I've been using c# since 2001 and haven't seen parameter attributes except in your post.
I *suspect* that there is a massive and dirty hack in the source code you have. Check the attribute and see if any the attribute code does anything, if so, the orignal programmer pobably intended for the code to be called each time the method is called. That would be appalling however.
|
|
|
|
|
Is your question not answered? What do you want to know exactly?
|
|
|
|
|
Don't repost your questions. It's very rude and drowns out the interesting ones.
|
|
|
|
|
Hi, guys,
How could I make it possible to drag down and select even those parts which are invisible when drag event starts? Similar to Notepad or MS Word tools. Any suggestions would be appreciated!!
Best Regards!
I don't wonder what, but wonder why...
|
|
|
|
|
Leapsword wrote: How could I make it possible to drag down and select even those parts which are invisible when drag event starts?
Drag on what?
What sort of application is it? Windows Forms, ASP.Net, Web; what?
What Controls are you using, what are you dragging on/over?
To get an answer to your problem, you have to describe it fully.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi, Henry,
Sorry for my careless mistake. I am still working on Windows Forms Application, and the control I am using now is a TableLayoutPanel, I want to drag over this control, but since there will be also a scrollbar next to this Panel, and this Panel is not showing totally the whole, I am expecting a kind of event which can handle this and if user didn't release the mouse, the Panel can move down as well as the scrollbar scrolls. Is this clear enough now? Your kind help is so much appreciated!
Sincerely
Liang
|
|
|
|
|
Hello everyone
I need to save the word file as PDF.
I am using Microsoft.Office.Interop for that
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;
But after it gets saved to the destination folder, pdf doesn't get open,
as the pdf file gets corrupted.
Please help me to do this job done.
Thanks & Regards
Sheetal Rawat
|
|
|
|
|
Hi..
I am new in C#..How we work with CSV files as database..Please send me any article link for CSV fundamental.
Thanks...
Abbas
|
|
|
|
|
|
CSV isn't meant as a database, just as XML or Excell-files. That something is possible, doesn't mean that it's a good idea.
XML and CSV are slow if you treat them as a database, since the layout isn't optimized for that kind of access. Your best bet would be to use database, and export the pieces you need to CSV. If you're looking for something free and simple, consider SQLCE.
That being said, it is possible to read/write CSV data as if it were a database. You'll only need a connectionstring[^]
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
-- Martin Golding
|
|
|
|
|
|
if u r new in C#, better dont use CSV for database..
This code was posted by me...
|
|
|
|
|
CSV can be a useful format for importing/exporting data, but although it's possible to do so, I wouldn't recommend using it as a DB.
|
|
|
|
|
If you must use a CSV file take a look at this[^] utility.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
I am working on a device application using Visual Studio 2005 (C#). in the application i need an option to stream vdos within the application. i tried the web browser component by giving embed code as its document text to embed an flv player. no error is shown.. but i guess compact framework is not supporting ActiveX... it just displays a blank browser.. when i tried the same embed code on an HTML page... it is working........is there any way i can do this on a device application?
This code was posted by me...
|
|
|
|
|
In what order is the Socket.BeginReceive/EndReceive functions called?
For instance, I call BeginReceive twice, once to get the message length and the second time to get the message itself. Now the scenario is like that, for every message I send, I start waiting for its completion (actually acknowledgment of the message sent, also I wait for the action's completion after receiving the acknowledgment), so I call BeginReceive with each BeginSend, but in each BeginReceive's callback, I check if I'm receiving the length or the message. If I'm receiving the message and have received it completely, then I call another BeginReceive to receive the completion of the action. Now this is where things get out of sync. Because one of my receive callback is receiving bytes which it interprets as the length of them message when in fact it is the message itself.
Now how do I resolve it?
Here is the code, basically it is too big, sorry for that
public void Send(string message)
{
try
{
bytesSent = 0;
writeDataBuffer = System.Text.Encoding.ASCII.GetBytes(message);
writeDataBuffer = WrapMessage(writeDataBuffer);
messageSendSize = writeDataBuffer.Length;
clientSocket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None,
new AsyncCallback(SendComplete), clientSocket);
}
catch (SocketException socketException)
{
MessageBox.Show(socketException.Message);
}
}
public void WaitForData()
{
try
{
if (! messageLengthReceived)
{
clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, MESSAGE_LENGTH_SIZE - bytesReceived,
SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket);
}
public void Send(string message)
{
try
{
bytesSent = 0;
writeDataBuffer = System.Text.Encoding.ASCII.GetBytes(message);
writeDataBuffer = WrapMessage(writeDataBuffer);
messageSendSize = writeDataBuffer.Length;
clientSocket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None,
new AsyncCallback(SendComplete), clientSocket);
}
catch (SocketException socketException)
{
MessageBox.Show(socketException.Message);
}
}
public void WaitForData()
{
try
{
if (! messageLengthReceived)
{
clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, MESSAGE_LENGTH_SIZE - bytesReceived,
SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket);
}
else
{
clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, messageLength - bytesReceived,
SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket);
}
}
catch (SocketException socketException)
{
MessageBox.Show(socketException.Message);
}
}
public void RecieveComplete(IAsyncResult result)
{
try
{
Socket socket = result.AsyncState as Socket;
bytesReceived = socket.EndReceive(result);
if (! messageLengthReceived)
{
if (bytesReceived != MESSAGE_LENGTH_SIZE)
{
WaitForData();
return;
}
int length = BitConverter.ToInt32(receiveDataBuffer, 0);
length = IPAddress.NetworkToHostOrder(length);
messageLength = length;
messageLengthReceived = true;
bytesReceived = 0;
WaitForData();
}
else
{
if (bytesReceived != messageLength)
{
WaitForData();
}
else
{
string message = Encoding.ASCII.GetString(receiveDataBuffer);
MessageBox.Show(message);
bytesReceived = 0;
messageLengthReceived = false;
receiveDataBuffer = new byte[AsyncClient.BUFFER_SIZE];
WaitForData();
}
}
}
catch (SocketException socketException)
{
MessageBox.Show(socketException.Message);
}
}
public void SendComplete(IAsyncResult result)
{
try
{
Socket socket = result.AsyncState as Socket;
bytesSent = socket.EndSend(result);
if (bytesSent != messageSendSize)
{
messageSendSize -= bytesSent;
socket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None,
new AsyncCallback(SendComplete), clientSocket);
return;
}
messageLengthReceived = false;
bytesReceived = 0;
WaitForData();
}
catch (SocketException socketException)
{
MessageBox.Show(socketException.Message);
}
}
|
|
|
|
|