|
Do you want multiple whitespace characters changed to one SPACE? Or each whitespace character changed to a SPACE?
|
|
|
|
|
Here is my combobox which gets values from database:
da2.TableMappings.Add("Table", "SubjectTitle");
da2.Fill(ds2);
this.dviewmanager = ds2.DefaultViewManager;
this.comboBox1.DataSource = this.dviewmanager;
this.comboBox1.DisplayMember = "SubjectTitle.Title";
this.comboBox1.ValueMember = "SubjectTitle.ID";
When I want to insert some data to database with value from combobox everything is perfect.
string insertQuery = "INSERT INTO Lection (ID_Subject, title, body) values ('" + comboBox1.SelectedValue + "','" + textBox3.Text + "','" + textBox4.Text + "')";
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = insertQuery;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
But when I want to select data with combobox in query I get Type mismatch error
leccom = new OleDbCommand("SELECT * FROM Lection WHERE ID_Subject ='" + comboBox1.SelectedValue + "'", leccon);
lecadapter = new OleDbDataAdapter();
lecadapter.SelectCommand = leccom;
lectable = new DataTable();
lecadapter.Fill(lectable);
textBox3.DataBindings.Add("Text", lectable, "Title");
textBox4.DataBindings.Add("Text", lectable, "Body");
lecmanager = (CurrencyManager)this.BindingContext[lectable];
ID_Subject field in database is numeric. I tried to convert combobox to an integer, but it didn't work or maybe I did it wrong. Why is this SELECT query doesn't work? Thanks in advance for any help!
|
|
|
|
|
fecaloid monster wrote: Why is this SELECT query doesn't work?
What is the error you are getting? If ID_Subject is a numeric field, you don't have to put the value in single quotes (''). Does that solves the problem?
Your code is open to SQL Injection attacks and you need to do some reading on that.
|
|
|
|
|
Oh, thank you so much, it works! And thanks for remark, i will consider that fault.
|
|
|
|
|
Dear All,
I have an SQL Server database, looking for the best data modeling tool that can develop a detailed report of my database
Any idea ?!
Regards,
Muhammad Nauman
"Mess with the Best, Die like the rest"
|
|
|
|
|
M. Nauman Yousuf wrote: Any idea ?!
Try a different forum?[^]
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi all,
I have a WinForm application that should display the Startup Mode of a service.
I'm using ManagementObject to access it, like that:
ManagementObject mgmtObject = new ManagementObject("Win32_Service.Name='Dhcp'");
mgmtObject.Get();
If I access any of the values of mgmtObject in the debugger it says: "Function evaluation timed out".
The same code works perfectly in a console application.
I've googled for long but couldn't find anything that explains this.
Thanks,
darthBug
Join the dark side of the code
|
|
|
|
|
Not sure what the problem is. This works fine for me in WinForms
ManagementObject mgmtObject = new ManagementObject("Win32_Service.Name='Dhcp'");
MessageBox.Show(mgmtObject.Properties["StartMode"].Value.ToString());
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
It's probably not the WinForm's fault but I can't figure out why it fails.
Is there a way took analyze this problem and find the source or the error?
darthBug
Join the dark side of the code
|
|
|
|
|
The normal debugging/breakpoints/stacktrace etc.
If you can't get to the bottom of it, post a little more code and I'm sure one of us can help.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi,
Thanks for the reply.
The wierd thing is it seems to be working during run time but inside the debbuger I get the error.
When I was debugging it I got the error and thought it wasn't working at all, didn't really bother to let it go all the way.
Thanks,
darthBug
Join the dark side of the code
|
|
|
|
|
Hi,I need you to help me with the c# code for help function.Me and my project team members are going to develop system for security soon .
|
|
|
|
|
Well, and the question is?
|
|
|
|
|
Member 4374474 wrote: I need you to help me with the c# code for help function.
Member 4374474 wrote: Me and my project team members are going to develop system for security
What security???
Please be specific about your question which can be yield more suggestions.....
Have a Happy Coding.....
|
|
|
|
|
Shan't and won't!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Scary thing is you have a team and you think you can develop something. I hope like hell you don't have a paying client.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I want to implement the keyboard driver in c#?
How can I start it?
can I do this with the help of BHO?
|
|
|
|
|
1. Don't use ALL CAPS.
2. Why do you want to use C#, of all things, for a driver?
3. Please be more specific with your questions.
|
|
|
|
|
I had already had a BHO in c# which is generated through
http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51&select=2421069
I had character mapping done in c# using delegates. The main thing is I want to get the position or tag element attributes ( name or id of that tag element) where cursor position is set on browser window. How can I get this?
|
|
|
|
|
If I understand you correctly, and I doubt it (considering the vagueness of it all), what you are making is not a driver. That would actually be good news, since that means whatever it is you're doing might actually be possible.
|
|
|
|
|
Hi,
I was faced with the situation where at runtime I needed to create a type that derives from an existing types overriding some of its properties.
I decided to use Reflection.Emit and uitilized ILDASM to help with the il code.
It seems simple enough to implement. I'm using .Net 3.5 and am unsure if there is a more uptodate way of doing this, does anyone know?
|
|
|
|
|
DavidRen23 wrote: runtime I needed to create a type that derives from an existing types overriding some of its properties.
Are you creating the type at run time or invoking already created type using reflection? If you are creating type, you need to compile it before invoking. Look at CSharpCodeProvider[^] class. This will be easier than Reflection.Emit , I guess.
|
|
|
|
|
Thanks for the quick response, the CSharpCodeProvider class is something I will definitely use in the future. As of now everything is set up to use Reflection.Emit, HOWEVER I'm having a problem now defining an overriden property in my derived type. I'm assuming that I only have to define the get method in my derived type because the property (virtual by the way) already exists in the base type?
The error I get when I create an instance of the derived type and try to access the property is
'((Property)(derivedType)).Property' threw an exception of type 'System.InvalidProgramException' string {System.InvalidProgramException}
Any ideas?
Thanks
David.
|
|
|
|
|
Try running peverify.exe over the emitted IL - that'll give you a more clear error message.
|
|
|
|
|
Dear ALL
now i made an App C# which it write an EXE to a certain Path and it lock this file , now i need the same app to run this EXE while its locked !! ??
How?? does any one have an idea?
thanks
bye
|
|
|
|