|
Dear,
Thank you for reading this question, please help me out if you can.
I got a paradox table without primary key, now I am trying to insert data into it, but keep getting an error: "Operation must use updateable query". Now after doing some readings, I found that it is because the table doesnt have a primary key, and the suggestion was to create a primary key for the datatable...
Now how do i do that? I also try to use the InsertCommand, but doesn't know how it works.. if someone could please explain this to me.. like how it works, and when it get triggered..etc
thank you.
Elapid
elapidd@yahoo.com
Elapid needs help.
|
|
|
|
|
elapid wrote:
Now how do i do that?
The DataTable class has a PrimaryKey property which takes a DataColumn array, where each data column in the array is a column of the data table that is the primary key.
So, you would do something like:
dt.PrimaryKey=new DataColumn[] {dt.Columns["ID"]};
Of course, the real question is, why doesn't your table in the database have a primary key? If you load the data set with schema information, the data table should already be configured with the primary key, I think.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Marc,
I understood the primary key part, but in paradox table, i dont really know how to make a [name].DB (paradox table) with a primary key.
mysql command is : create table Test.DB (Code varchar(2) primary key, Desc varchar(30))
and it keeps bombing on me saying index 345-3-543-5-34 is not valid
any suggestion?
Elapid For The Win
|
|
|
|
|
|
I was reading a simple article on the Command Pattern and had a quick question.
The article is short and its here:
http://www.c-sharpcorner.com/Code/2002/Mar/CommandPatternsInCSCKU.asp[^]
For example if I had a base Class DVDPlayer and I wanted a status on the player would this be implemented this way ??
<br />
public class DVDPlayer : ICommand <br />
{<br />
protected string mCDStatus="";<br />
<br />
public CDPlayer()<br />
{<br />
<br />
}<br />
public string CDStatus<br />
{<br />
get{return this.mCDStatus;}<br />
}<br />
<br />
public void Execute()<br />
{<br />
<br />
}<br />
public class DVDPlay: DVDPlayer, ICommand <br />
{<br />
public CDPlay()<br />
{<br />
<br />
}<br />
public new void Execute()<br />
{<br />
base.mCDStatus = "Playing";<br />
}<br />
<br />
}<br />
<br />
With my main method like this ??:
<br />
Remote rm = new Remote();<br />
CDPlayer player = new CDPlayer();<br />
player = new CDPlay();<br />
rm.Invoke(player);<br />
MessageBox.Show(player.CDStatus.ToString());<br />
Is this the best implementation ?? Good Design ? Any ideas ?
thks in advance ..
Note : Remote class below:
<br />
public class Remote<br />
{<br />
public Remote()<br />
{<br />
<br />
}<br />
public void Invoke(ICommand cmd)<br />
{<br />
cmd.Execute();<br />
}<br />
<br />
}<br />
|
|
|
|
|
Dato wrote:
Is this the best implementation ??
hmm
Dato wrote:
public string CDStatus
{
get{return this.mCDStatus;}
}
Dato wrote:
MessageBox.Show(player.CDStatus.ToString());
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Why not just modify the original source code?
I take it that ICommand specifies the Execute method? It's really bad practice to use "new", and it shows that the original implementer didn't design the class correctly--the base class that implements Execute should be declarated as virtual, so derived classes can override it.
Why are you doing CDStatus.ToString() when CDStatus returns a string?
I also don't like the "this.mCDStatus", in particular, the "this.". It's redundant and unnecessary. "return mCDStatus" is quite sufficient.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Hi guyz, I'm developing a small experimental application for myself...and I want to implement some motion detection algorithms.
However, I want to take the input from a webcam. Therefore my question is:
How do you use a webcam through C#??
Any help is highly appreciated (even a web tutorial would be a nice suggestion!)
ThankS
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
|
10Q for your help!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
|
10q for your help!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
I have readed this article:
http://www.codeproject.com/cs/miscctrl/AlphaBlendTextBox.asp
it allow to download a dll to implement the custom textbox.
How can i use that dll in my project?
Thanks
|
|
|
|
|
add arefernce to it in your soulution explorer //if you are using VS.NET.
|
|
|
|
|
can you tell me how? i'm newbie
|
|
|
|
|
In the solution explorer ,you will find icon called reference ,right click it ,and then click add reference and then browse to your dll .
|
|
|
|
|
ok i've done thanks, but now to use that object inside my form ho can i do?
|
|
|
|
|
i mean to see it in the toolbar, so i can drag in my form when i want how can i do?
|
|
|
|
|
If you were pointing at this from the beginning you wouldn't have the dll added to your project.
Just right click the toolbar and then choose Add/Remove items Link and click on it ,and then browse to your dll and every control contained in it will be added to the toolbox and then by only dragging it to your form the reference to this dll will be added automatically .
|
|
|
|
|
Yet again I am stuck. I've followed many code examples, most of which are wholly different and do not explain the small details I am lacking in my implementation. Basically what has happened is that, using the Async message sending I have implemented, the messages run together and mix data, which is obviously no good. I assumed that the Async BeginSend took care of this, but I guess I was wrong, either that or I did it wrong. The code below is my basic implementation:
<br />
public void SendMessage(String msg) <br />
{<br />
try<br />
{<br />
if(m_sndCallBack == null) <br />
{<br />
m_sndCallBack = new AsyncCallback(OnDataSent);<br />
}<br />
SocketPacket packet = new SocketPacket();<br />
packet.thisSocket = m_clientSocket;<br />
<br />
packet.dataBuffer = Encoding.UTF8.GetBytes(msg);<br />
<br />
m_clientSocket.BeginSend(packet.dataBuffer,<br />
0, packet.dataBuffer.Length,<br />
SocketFlags.None, <br />
m_sndCallBack, <br />
packet);<br />
}<br />
catch(SocketException se)<br />
{<br />
Debug.WriteLine(se.Message);<br />
} <br />
}<br />
public void OnDataSent(IAsyncResult asyn)<br />
{<br />
SocketPacket theSockId = (SocketPacket)asyn.AsyncState;<br />
try<br />
{<br />
int iRx = theSockId.thisSocket.EndSend (asyn);<br />
theSockId.thisSocket = null;<br />
}<br />
catch (ObjectDisposedException )<br />
{<br />
Debug.WriteLine("Web.OnDataReceived: Socket has been closed");<br />
}<br />
catch(SocketException se)<br />
{<br />
Debug.WriteLine("Web.OnDataReceived: "+se.Message);<br />
}<br />
}<br />
Now my typical calling, which may be the problem? would be:
ClientServer.SendMessage("CONNECT:username:password");
...
ClientServer.SendMessage("REQUEST:STATUS");
ClientServer.SendMessage("REQUEST:LIST");
and the server receives:
CONNECT:username:passwordREQUEST:STATUS...
Am I supposed to be waiting on the data to be sent? And if so, should I not even implement the sending using Async code? Any help would be greatly appreciated.
|
|
|
|
|
If your protocol demands that messages must be sent in a particular order, then you shouldn't use BeginSend. Each BeginSend will use a threadpool thread to run, so there is no guarantee as to the order in which the messages will actually be sent.
Waiting till the callback completes before sending the next message will solve your problem.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Where would the best place to implement the wait be?
If only I could find GOOD async code to model my implementation hah...
I am contemplating just writing synchronously and reading asynchronously because it doesnt really matter what order the messsages are received just that they are a single message.
Thanks
|
|
|
|
|
Is it OK if the server receives message like
REQUEST:STATUSCONNECT:username:password... ??
That's what I meant by the ordering problem, your messages themselves could get mixed up.
I'd typically implement this by creating my own thread and running a queue system there. All messages to be sent are posted to the queue and the queue synchronously processes them.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks, works beautifully, I figured the problem was the Async sending but I wasn't sure.
|
|
|
|
|
who's use powerbuilder tool or have ebook ! please help me.
thank you very much.
|
|
|
|