|
I suggest you read and study this article[^], even if you are using a different version of Visual Studio.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
|
Good morning,
I am working on a smart device application.
I want to create a listbox with 3 columns which get there data from a local database .sdf
I tried the following code but an exception occurred.
private void button1_Click(object sender, EventArgs e)
{
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(wCS);
SqlCeCommand command = sqlceconn.CreateCommand();
command.CommandText = "SELECT [ID]+\" \"+[Magasin]+\" \"+ [qtyonhand] AS IMQ from stocks where ID like %@txt%";
SqlCeDataAdapter adapter = new SqlCeDataAdapter(command);
SqlCeParameter txt = new SqlCeParameter("@txt", SqlDbType.NVarChar);
txt.Value= textBox1.Text;
command.Parameters.Add(txt);
DataSet ds = new DataSet();
adapter.Fill(ds);
listBox1.DataSource = ds.Tables[0];
listBox1.DisplayMember="IMQ";
}
this is the exception
there is an error parsing the querry. [token line number =1, token line offset=77, Token in error = %]
thank you in advance.
|
|
|
|
|
Of course there's an error...your select command is not written correctly.
This is what it looks like to SQL:
SELECT [ID]+" "+[Magasin]+" "+ [qtyonhand] AS IMQ from stocks where ID like %@txt%
You need to look at a SQL reference and see how to write a proper SQL Select statement.
Why did you put in +\" \" ? Where in the world did you see that.
And please, start using proper naming conventions. When you add a control, change it's name to reflect what it is and what it holds. Take a look here: Naming convention[^]
|
|
|
|
|
hello
I would like to know the role of substitution in our applications, I searched but I don't understand its usefulness.
thank you
|
|
|
|
|
Are you talking about Substitution Class i.e; <asp:Substitution /> ?
Check its usage and examples here
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Hi,
Can anyone recommend a library that I can use for my winforms .net project to generate barcodes of different types/formats?
Thanks in advance.
Rafferty
|
|
|
|
|
|
Thanks for the reply. I was hoping for a linear barcode generator, our intended barcode scanner will not be able to read 2D
Rafferty
|
|
|
|
|
search the CodeProject articles, there are many on barcodes.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
hi all,
i am trying to export my C++ functions to C#. and i have succeeded in exporting them. while importing the functions. now to one of such functions, i want to pass two newly defined functions in C# as arguments, how should i achieve this. kindly help me.i am very badly in need of the solution to complete my project.
this is how i have implemented:
1. function exporting from C++:
extern __declspec(dllexport) bool Callregistercallback(CRTSPWrapper* pObject,funccallback fptr_video,funccallback fptr_audio,void* ptr);
where funccallback is a function pointer
2. function call in C++ test application
m_oSarixrtsp->registercallback(GetVideoPacket,GetAudioPacket,NULL);
where GetVideoPacket and GetAudioPackets are functions that are defined in the main of C++
3.function importing in C#
[DllImport("sampleclient_dll.dll", CharSet = CharSet.Ansi)]
static private extern bool Callregistercallback(IntPtr pTestClassObject,IntPtr fptr_video,IntPtr fptr_audio,IntPtr ptr);
4.function defintion in C#:
here i have defined two delegates to the functions namely Getvideopacket and getaudiopacket as follows:
public delegate void getadelegate(char[] pBuffer, int nSize);
public delegate void getvdelegate(char[] pBuffer, int nSize);
public bool registercallback([MarshalAs(UnmanagedType.FunctionPtr)]IntPtr fptr_video, [MarshalAs(UnmanagedType.FunctionPtr)] IntPtr fptr_audio, IntPtr ptr)
{
getvdelegate objv = new getvdelegate(Getvideopacket);
getadelegate obja = new getadelegate(Getaudiopacket);
return Callregistercallback(this.m_pNativeObject, fptr_video, fptr_audio, ptr);
}
5.function call from test application in C#:
testclass.registercallback(Getvideopacket,Getaudiopacket,null);
this is resulting in a compile time error stating: cannot convert a System method to System IntPtr.
Kinldy help me out please. thanks in advance.
regards
sindhu
|
|
|
|
|
There is quite alot of code here interspersed in mixed languages with non code which makes it rather difficult to find what is what.
Could you edit you post wrapping the code parts in <pre> </pre> tags (you can highlight the code and click the 'code block' link above to do this automatically)? It would be helpful if you could use different pre blocks for each language section.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
that is unreadable, lacking PRE tags; as it involves P/Invoke, maybe this[^] helps.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
sindhumahe wrote: and i have succeeded in exporting them
Are really certain that you have succeeded?
It seems not.
First you need to ensure that your function is exported property.If you use the definition:
extern __declspec(dllexport) bool Callregistercallback(CRTSPWrapper* pObject,funccallback fptr_video,funccallback fptr_audio,void* ptr);
without appropriate definition of the function inside the library module definition file,or without setting configuration the compiler to compile the lib as C code you will be unable to call it using:
[DllImport("sampleclient_dll.dll", CharSet = CharSet.Ansi)]
static private extern bool Callregistercallback(IntPtr pTestClassObject,IntPtr fptr_video,IntPtr fptr_audio,IntPtr ptr);
That happens because by default every function is compiled as C++ code not as C code and C++ uses names decoration to avoid conflicts between functions with the same names but with different arguments.
Refer to this article for more details how to properly export your functions.
Life is a stage and we are all actors!
|
|
|
|
|
Hi,
I'm trying create a sample ActiveX control. In this process, I need to create a cab file from setup exe file using CABSDK. Please guide me. Thanks in advance.
|
|
|
|
|
This is a C# forum - for creating a cab file - see here.
modified on Wednesday, May 12, 2010 2:30 AM
|
|
|
|
|
Hi all,
Ive making trial version application. Its works fine but i do need to encrypt the data in mySQL or change the password for the respective database. Anyone can help me?
Thanks u and really appreciate ur help.
|
|
|
|
|
You need to encrypt data in csharp and store as a varchar in mysql
That's it.
For encrypting and decrypting in csharp find following article useful.
Encrypt and Decrypt Data with C#[^]
Hope this will help!
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi,
I'm going to try to explain this the best I can. I have a SQL table that contains a datetime field that I am using a date picker control. This field is a verification date field for the last time the information was verified. This field can also be null if the data has not been verified. I am using a checkbox on the date picker so if the information has been verified it is checked, unverified not checked.
Since SQL has no concept of this checkbox, I have written some code that works almost perfect. It gets the current row like this:
var currentRow =
((myDataSet.ReunionRow)(((DataRowView)
(myBindingSource.Current)).Row));
and then sets the checkbox accordingly like this:
if (currentRow.IsVerifiedNull())
{
verifiedDateTimePicker.Value = DateTime.Today;
verifiedDateTimePicker.Checked = false;
Debug.WriteLine("Verified is null");
}
else
{
verifiedDateTimePicker.Value = currentRow.Verified;
verifiedDateTimePicker.Checked = true;
}
So far so good, you can navigate through the data forwards/backwards everything looks great. Then the user decides to change the verified information and doesn't click the save button on the navigator bar, scrolls away from this row and eventually comes back to it. My code happily gets the old data!
So my question is how can I tell if this row is modified to skip this logic, or how can I get the modified row?
Thank you,
Glenn
|
|
|
|
|
Check the DaraRow.DataRowState property.
Also, if you want a list with all the changes you could call DataTable.GetChanges .
Check MSDN for those properties.
Note that those properties are not static, they must be called upon an instance.
I have no smart signature yet...
|
|
|
|
|
Several years ago I taught myself a good deal of C++ but had to put it down due to time restrictions. I'd like to pick programming back up however as a hobby as I find enjoyment in building things.
That said I followed this individuals tutorial(among other things) like 4 years ago? His walkthrough in a full project start to finish was a massive educational jump for me regarding C++
http://www.stromcode.com/2008/03/01/cwin32-tutorials/[^]
The link will bring you to Stromcodes C++ Port Scanner.
I am wondering if there are similar tutorials for C# now. When I google search c# lessons/tutorials most of the lessons are extremely dry, boring, and a repeation of things I already know from my C++ days(I was never really anything beyond intermediately familiar mind you). I don't really need to do much of the beginner stuff however(short of glancing it over), and if I get stuck it's usually a few Google searches away to figuring out.
Does anyone have any recommendations on a way to quickly dive into the language while having some fun?
Also does anyone recommend John Smiley's book "Learning to Program with C#"?
Thanks everyone!
|
|
|
|
|
|
|
|
I have not personally read John Smiley's book, but you can read some comments here.
You can learn C# lesson by lesson here. It helped me a lot.
All the best
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|