|
Hi,
There is a system stored procedure for database backup functionality. (I cannot remember the sp's name at the moment).
So you can execute that sp from your C# code.
Hope this helps to you.
http://msdn2.microsoft.com/en-us/library/ms188409.aspx
Regards!
jayasshc
|
|
|
|
|
Backup/Restore Programatically[^]
I think you need to add an SP with BACKUP functionality and execute that
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
|
Do you have a question? What was the point of your post?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
There's a link in my thread, read it at it's location and answer here if you can. Thanks.
|
|
|
|
|
Example:
....<br />
Thread a = new Thread(method1);<br />
a.Start();<br />
....<br />
....<br />
void method1() {<br />
textBox1.Text = "Hello";<br />
}
if i execute that code, they give me an InvalidOperationException error (access to textbox1 from another process)
i try to call that method using an delegate, but not works
another way is add this code:
CheckForIllegalCrossThreadCalls = false;
but i don't need to deactivated that
how i can fixed?
|
|
|
|
|
you can access a Control only from the thread that created it, normally the main thread.
Read up on Control.InvokeRequired and Control.Invoke()
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
need some tutorial or example please (to understand)
|
|
|
|
|
MSDN, Google and CodeProject are full of examples: almost every app that uses extra threads
needs it!
Here is an example in VB.NET[^], the last code snippet shows the principle.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Y readed and works fine
my C# Code:
public delegate void updatevalores(string dato);<br />
private void actualizarv(string datos) {<br />
if (this.InvokeRequired)<br />
{<br />
this.Invoke(new updatevalores(actualizarv),new object[]{dato});<br />
return;<br />
}<br />
listBox1.Items.Add(dato.ToString());<br />
}
Thanks for all
|
|
|
|
|
I am trying to pass a structure to unmanaged C and the unmangaed C returns an error because it thinks a value within the struture is set to a different value then the c# has set it to prior to passing it to the unmanaged c. I dont't have access to the C code.
[StructLayout(LayoutKind.Sequential)]<br />
public struct PASSTHRU_MSG<br />
{<br />
public UInt32? ProtocolID;<br />
public UInt32? RxStatus;<br />
public UInt32? TxFlags;<br />
public UInt32? Timestamp;<br />
public UInt32? DataSize;<br />
public UInt32? ExtraDataIndex;<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4128)] <br />
public byte[] Data;<br />
}<br />
<br />
[DllImport("CARDA432.DLL", EntryPoint = "PassThruStartMsgFilter", ExactSpelling =true)]<br />
public static extern UInt32 PassThruStartMsgFilter(UInt32 ChannelID, UInt32 FilterType, ref PASSTHRU_MSG pMaskMsg, ref PASSTHRU_MSG pPatternMsg, ref PASSTHRU_MSG pFlowControlMsg,ref UInt32 pMsgID);<br />
<br />
MaskMsg.Data = new byte[4128];<br />
MaskMsg.ProtocolID = 5;<br />
MaskMsg.DataSize = 4;<br />
MaskMsg.Data[0] = 0xff;<br />
MaskMsg.Data[1] = 0xff;<br />
MaskMsg.Data[2] = 0xff;<br />
MaskMsg.Data[3] = 0xff;<br />
PatternMsg.Data = new byte[4128];<br />
PatternMsg.ProtocolID = 5;<br />
PatternMsg.DataSize = 4;<br />
PatternMsg.Data[0] = 0x00;<br />
PatternMsg.Data[1] = 0x00;<br />
PatternMsg.Data[2] = 0x07;<br />
PatternMsg.Data[3] = 0xE8;<br />
<br />
FlowMsg.Data = new byte[4128];<br />
FlowMsg.ProtocolID = 5;<br />
FlowMsg.TxFlags = 0;<br />
FlowMsg.DataSize = 0x04;<br />
FlowMsg.Data[0] = 0x00;<br />
FlowMsg.Data[1] = 0x00;<br />
FlowMsg.Data[2] = 0x07;<br />
FlowMsg.Data[3] = 0xE8;<br />
<br />
if ((status = PassThruStartMsgFilter(ChannelID, FLOW_CONTROL_FILTER, ref MaskMsg, ref PatternMsg, ref FlowMsg, ref FilterID)) != STATUS_NOERROR)<br />
{<br />
status = PassThruGetLastError(serror);<br />
MessageBox.Show(serror.ToString());<br />
}<br />
the function returns an error stating that the MaskMsg.ProtocolID = 1 (the code is expecting 5 as set by the c# code) and I can't figure out why? There must be an issue with the memory getting overwritten or the "pointer" not being referenced properly.
|
|
|
|
|
It doesn't matter what I set the ProtocolID to the code always errors out with ProtocolID =1.
The original C-code
typedef struct<br />
{<br />
unsigned long ProtocolID;<br />
unsigned long RxStatus;<br />
unsigned long TxFlags;<br />
unsigned long Timestamp;<br />
unsigned long DataSize;<br />
unsigned long ExtraDataIndex;<br />
unsigned char Data[4128];<br />
} PASSTHRU_MSG;<br />
<br />
long PassThruStartMsgFilter(unsigned long ChannelID, unsigned long FilterType, PASSTHRU_MSG *pMaskMsg, PASSTHRU_MSG *pPatternMsg, PASSTHRU_MSG *pFlowControlMsg, unsigned long *pMsgID); <br />
<br />
<br />
-- modified at 19:44 Thursday 11th October, 2007
|
|
|
|
|
I have never seen a nullable type being passed to unmanaged code, and I don't expect
it to work like that, so first thing to do is drop all the question marks.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
It doesn't seem to matter if the other variables are null or defined. And other api calls require the PASSTHRU_MSG to be null.
I have had the questions marks there and not and still fail with the same error.
Thanks.
|
|
|
|
|
Hi,
an Uint32 is a value type, taking 4 bytes of memory inside the struct.
an Uint32? is a reference type, taking a 4B (or 8B on Win64) pointer inside the struct
and an object on the heap, quite different from what your C code expects.
So, yes removing the questions marks is a necessary step towards a solution.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Fair enough. I'll give it another shot.
|
|
|
|
|
Thanks. Removing the ? seems to be working now. This is much appreciated. Sorry for doubting you. Nice Job.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I have a gridview with 2 bound columns and 1 template column(chkSalbud).
The bound columns are the Id and Name.
In the gridView_updating event,
protected void GridView_Updating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = GridView.Rows[e.RowIndex];
if (row != null)
{
int chkSalbud = Convert.ToInt16((((CheckBox)row.FindControl("editchkSalbud")).Checked));
???? [here similarly i need to find the bound columns id and name values. the name field is readonly and the id field is visible=false]
}
}
Am trying to avoid keeping the values in dataset. Should I use template column for id and name or can I do with bound column itself?
Please help me.
Thanks
|
|
|
|
|
Hey!
I need a timer for my program that can start counting when I tell it to and then stop when I tell it to. After it's stopped I want to write the number of seconds counted before it was stopped.
Well, I'll try to explain better what I mean with the following code:
<br />
START COUNTING HERE<br />
<br />
while(whatever)<br />
{<br />
whatever<br />
}<br />
<br />
STOP COUNTING HERE<br />
<br />
WRITE HOW MANY SECONDS IT TOOK<br />
<br />
--
Joplinazz
--
|
|
|
|
|
Well - you could do this without using a timer at all. Have a button on your form, which writes the time that the button was pressed to a member variable of type DateTime. Then have a second button that takes the time that the button was pressed away from DateTime.Now . That's how long it took to run.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Just a standard System.Windows.Forms.Timer sounds like what you need. Set the interval to 1 second, and have an incremental integer adding for every cycle the timer takes.
static System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer();
int iCurrentSeconds = 0;
private void NotificationConfig_Load(object sender, EventArgs e)
{
tmr.Tick += new EventHandler(TimerEventProcessor);
tmr.Interval = 1000;
tmr.Start();
}
private void TimerEventProcessor(object obj, EventArgs e)
{
iCurrentSeconds++;
Console.Writeline("Timer has been running for {0} seconds!", iCurrentSeconds);
}
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thank you both for your answers, I think this will solve the problem
--
Joplinazz
--
|
|
|
|
|
You bet, happy to help!
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Why do you actually need to do this? It seems a lot more complicated than getting the difference between two datetime objects. It's certainly a lot more code - which while not always a bad thing, certainly doesn't adhere to the KISS principal.
Deja View - the feeling that you've seen this post before.
|
|
|
|