|
It doesn't work because SqlCeConnection does not derive from SqlConnection and that's what the SqlDataAdapter is expecting.
You have to use the SqlCeDataAdapter class in the System.Data.SqlServerCe namespace.
|
|
|
|
|
Thanks,
That was helpfull.
In general, how does one find out 'what' derrives from 'what'
Also, what's the difference between the 'Ce' marked SQL funcionality, and the Not 'Ce' marked.
Does it mean that when I move to a comercial SQL DB that I have to re-write tons of code.
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: In general, how does one find out 'what' derrives from 'what'
The MSDN documentation on the class in question. It's the Inheritence Hierarchy at the top of the page.
Bram van Kampen wrote: Also, what's the difference between the 'Ce' marked SQL funcionality, and the
Not 'Ce' marked.
You appear to be using Sql Server COMPACT EDITION. If you move this code to using a full SQL Server, yes, you would have to rewrite everything that uses Sql Server CE.
Unless you're writing code to run on a device instead of a PC, I would suggest using Sql Server Express and not CE. CE is for running on devices, such as Windows CE.
|
|
|
|
|
Is possible make a connection to another Pc using modem like HyperTerminal o a Dialup connection and access can access to share folders, navigate...
Thx
|
|
|
|
|
Yes, but it's incredibly slow.
A modem in Windows is just another network gateway.
|
|
|
|
|
Hello.
I have built two projects that contains the following:
Project One
A native C++ DLL that exports a class.
A managed C++ DLL that allows the native DLL to be used by adding a reference to this managed DLL in a .NET Project.
Project Two
And a C# test application to test it all.
When I run the Test application everything works as expected. But when I copy the native.dll, managed.dll and Test.exe to another machine the test.exe fails to start complaining that it can find managed.dll or one of its components! But both the native.dll and managed.dll are in the same physical directory as test.exe, to say I'm confused is a bit of an understatement.
The projects were built as two solutions using Visual Studio 2012 Pro, native.dll and managed.dll as one solution and the tester in its own solution. The managed.dll and test.exe have a dependency on .NET 4.
Has anyone came across this behaviour before, and how was it fixed?
Bubba
|
|
|
|
|
.Net 4 comes in a few flavors ("Framework 4" or "Framework 4 Client Profile"). The Client Profile lacks some of the dlls of the full version. Try to install the full version on the target computer.
|
|
|
|
|
Thank you for the reply, but I have already installed this. When I originally copied the files over and ran the test.exe I was informed that I needed the .NET runtime installed.
So I downloaded dotNetFx40_Full_x86_x64 from Microsoft to address this, which of course adds to the confusion. The system (Windows 2008R2 x64) is up to date with service packs and updates so I don't really know where to go with this.
Bubba
|
|
|
|
|
Could also be an issue of bit-ness. Did you built for "Any CPU" or x86 or x64? The target system is 64 bit, and what about your development machine?
|
|
|
|
|
Hi Bernard, thanks again for the reply.
The DLL projects are built for x86 and the test application was built for AnyCPU. I've been of the understanding the x86 will work on x64 without issue, so I've no reason to suspect the DLLs in this case. I used the AnyCPU option for the test as I assumed I could then use a single test.exe to test either x86 or x64 builds of the DLL. But are you tell me this isn't the case?
Bubba
|
|
|
|
|
Yes, x86 works fine on x64. The problem is that you cannot mix 32- and 64-bit code in the same process, which is what it appears that you're doing.
Your .DLL's are all 32-bit and since you compiled the app that uses them as AnyCPU, it'll run as 64-bit on a 64-bit machine. You have to go into your project properties and, on the Compile tab, change the TargetCPU to x86.
The bitness (architecture-SA!) must match between your .EXE and your .DLL's. If you compiled the .DLL's as AnyCPU, it would have worked.
|
|
|
|
|
Hi Dave,
Thanks for the reply, and as a result I am wiser now than I was 5 minutes ago. I've built the test.exe as x86 and all is well. So the whole thing was down to my misunderstanding of the "AnyCPU", a lesson learned and a mistake I hope never to repeat.
Thanks.
Bubba
|
|
|
|
|
|
Please use the forum at the end of the article, and discuss with the author.
Use the best guess
|
|
|
|
|
|
hello i want to save my codes source after debug because any one can take your source code from yourfile.exe (*.exe) by reflector or winrar or notepad .
I Want your help all .
|
|
|
|
|
You need to look into the use of obfuscators[^], although none is 100% effective.
Use the best guess
|
|
|
|
|
Obfuscators will help you hide code. But there is no absolutely fool proof way of doing this.
|
|
|
|
|
|
hi
i create a custom datagridviewtextboxcolumn inherits from my control (that it inherits form textbox by some feature . for example limit to numberonly)
in my custom column I overrides onvalidating to check entered numbers before moving to another cells
my code is here :
Protected Overrides Sub OnValidating(e As CancelEventArgs)
If AllowNull = False Then
If String.IsNullOrEmpty(Me.Text.Trim) = True Then
e.Cancel = True
MessageBox.Show("لطفاً اطلاعات را وارد نمائید", "ارزیابی اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Select Case InputType
Case Inputs.NationalCode
If ValidateNcode(Me.Text.Trim) = False Then
e.Cancel = True
MessageBox.Show("لطفاً کد ملی را بصورت صحیح وارد نمائید", "ارزیابی اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Case Inputs.Numbers
If AllowNegative = True Then
If ismatched(Me.Text.Trim, negshregex) = False Then
e.Cancel = True
MessageBox.Show("فرمت اعداد صحیح نمی باشد" & vbNewLine & "حداکثر طول اعداد صحیح 15 رقم" & vbNewLine & "و حداکثر طول اعداد اعشار سه رقم می باشد", "ارزیابی اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
If ismatched(Me.Text.Trim, shregex) = False Then
e.Cancel = True
MessageBox.Show("فرمت اعداد صحیح نمی باشد" & vbNewLine & "حداکثر طول اعداد صحیح 15 رقم" & vbNewLine & "و حداکثر طول اعداد اعشار سه رقم می باشد", "ارزیابی اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
Case Inputs.Decimals
If AllowNegative = True Then
If ismatched(Me.Text.Trim, negshregex) = False Then
e.Cancel = True
MessageBox.Show("فرمت اعداد صحیح نمی باشد" & vbNewLine & "حداکثر طول اعداد صحیح 15 رقم" & vbNewLine & "و حداکثر طول اعداد اعشار سه رقم می باشد", "ارزیابی اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Else
If ismatched(Me.Text.Trim, shregex) = False Then
e.Cancel = True
MessageBox.Show("فرمت اعداد صحیح نمی باشد" & vbNewLine & "حداکثر طول اعداد صحیح 15 رقم" & vbNewLine & "و حداکثر طول اعداد اعشار سه رقم می باشد", "ارزیابی اطلاعات", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
End Select
End If
End Sub
when my custom column is in editing mode and I click by mouse to another place or cell ,if value of cell not matched , validating fired and prevent to move to another cell until user correct entered data. but when I press ENTER or Tab , validating showing message 2 time and move to another cell and don't prevent move to another cells
why press enter or tab not calling validating event ?
sh-a
|
|
|
|
|
After a month, finally found what I needed at this link.
http://www.aspnet-answers.com/microsoft/NET-WinForms-Controls/31106204/idatagridvieweditingcontrol-validation.aspx
sh-a
|
|
|
|
|
Hi,
Thanks everybody for the response to OnInitDlg equivalents. I now override 'OnLoad', and that got me started. What I'm now looking for is the equivalents for:
-CWnd::ShowWindow(SW_HIDE);
-CWnd::ShowWindow(SW_NORMAL);
I use:
namespace SgCntr
{
public partial class LogOn : Form
{
private void button_Exit_MouseClick(object sender, MouseEventArgs e)
{
this.Hide();
string message =
"Are you sure that you would like to Terminate \n"
"the Softguard Sales Terminal Application?";
const string caption = "Application Terminating";
var result = MessageBox.Show(message, caption,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.No)
{
this.Show();
return;
}
this.Dispose();
}
}
}
The this.Hide() doesnot just hide the logon box, but the entire application.
-CWnd::EndDialog(nDlgResult);
I use the Dispose method in the above sample, which returns 'DialogResult.Cancel'.
How do I make it return an int of my choice.
Thanks,
Bram van Kampen
|
|
|
|
|
Your logon form should be a separate but 'normal' form with labels, textboxes and buttons, as built with the designer. Then at the appropriate point in your main program you launch it by LogonForm.ShowDialog() , and you have a MFC-type modal dialog on the screen. When the user clicks the OK (or whatever) button, you just capture the inputs into your local variables, in the same way that you would in the OnOK() function in MFC. Something like:
this.Hide()
LogonForm lf = new LogonForm()
result = lf.ShowDialog();
variable = lf.textbox1;
When lf goes out of scope it will dispose itself so you do not need to.
Use the best guess
|
|
|
|
|
Thanks Richard,
that clarified some aspects of the problem. Maybe I should slightly rephrase.
As soon as I call:
result=lf.ShowDialog();
the dialog (or form) goes into some modal loop. I need to break out of that by clicking OK or Cancel. In other words, the handler code for the clicked button needs a method of breaking out of the modal loop.
N.B.Falling out of scope is a COMPILE time issue, never a RUN time issue. When execution reaches the closing scope brace, it will hit a compiler generated code block that carries out an effective cleanup and garbage collection. This would include (unlike MFC) that the Form Classes still displayed are automatically removed from the screen.
The form cannot fall out of scope while it is in the modal loop, and would remain on display forever. I used 'Dispose();' to break the circle, which on this occasion does the trick of breaking out of the loop. I am aware that this is not the proper way. For one, in doing so, lf is no longer available for interogation, and the line:
variable=lf.textbox1
would throw an exception.
In MFC I would use OnOK(), OnCancel(), or sometimes even EndDialog(nResult). How do I break out of the modal loop from within say a Button Event handler in C#.NET.
Kind regards,
Bram van Kampen
modified 16-May-13 20:34pm.
|
|
|
|
|
I think you misunderstand where the scope of the object starts and ends. The code snippet I showed you is the way to do it. When you press the OK button of your dialog, the dialog's window is no longer displayed, but the dialog object still exists, so you can extract the data from its components. For example:
void someMethod()
{
this.Hide()
LogonForm lf = new LogonForm()
result = lf.ShowDialog();
variable = lf.textbox1;
}
Use the best guess
|
|
|
|