|
Hello,
I want to develop a sample application for Remote Connection.
If you have any kind of link or Sample then please provide me.
Thanks in advance.
Best Regards,
Chetan Patel
|
|
|
|
|
How to create setup for C# Windows Application exe. I have tried uisng the Publish option in the application. The problem is with database path. I have put the database(.mdb) file in a separate folder called database. So in the ConnectionString I have given the database path as @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" + Application.StartupPath + @"\Database\dbCIMS.mdb;"
How do I include this database in the Setup using the Publish wizard. When I run the setup it was giving Invalid database path error.
Please help
Thanks in advance
|
|
|
|
|
|
Hi,
I have a textbox in which i want to implement wild card search. Like if i enter one char 'A', all the names starting with 'A' in database for that table should be listed. If i enter two chars, correspondingly data should be listed. Can anyone please tell me the solution? Code is in C#
|
|
|
|
|
Your problem shows there must be a table in your database which you want to target.If you are using that text box on ASP.Net page,
Try this one:
string searchkeyword=yourtextbox.text + "%"; (special character is for use with stored procedure)
stored procedure:
create procedure searchwithkeyword
(
@keyword nvarchar(50)
)
as
select names from yourtable where name like @keyword
now the code for button click event:
sqlconnection con=new sqlconnection(yourconnectionstring);
con.open();
sqlcommand com=new sqlcommand("searchwithkeyword",con);
com.commandtype=commandtype.storedprocedure;
com.parameters.addwithvalue("@keyword",searchkeyword);
sqldatareader dr=com.executereader();
if(dr.read());
{
//display results
}
else
{
//show message
}
dr.dispose();
com.dispose();
con.dispose();
The code is a bit messy as it is not implementing try catch and finally blocks but if it is worth helping do that yourself and let me know what happened to your problem.
|
|
|
|
|
I am working in C# with database already there. My application is about to release. Only i need to make this wild card implementation. Can you tell me how to do this in C#.net
|
|
|
|
|
You just do something like:
string searchstring = "%" + textbox.Text + "%"
and pass this search string as a parameter to a SQL LIKE in the WHERE clause, which will result in something like this:
SELECT id, name FROM users WHERE name LIKE '%A%'
But make sure that your app won't be vulnerable to SQL Injections[^].
regards
modified on Friday, July 25, 2008 4:53 AM
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks to all,will try this implementation and get back to you
|
|
|
|
|
Hi,
I have a textbox in which when i enter a character, i want it to be displayed be UPPERCASE. how to handle this condition? Reply soon.The code is in C#.
|
|
|
|
|
textBox1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
|
|
|
|
I have a List declared as,
List<string> myList = new List<string>;
myList.Insert(0, "One"); // this line works fine.
myList.Insert(1, "Two"); // This throws an exception, saying the index should be with in the range.
What am i doing wrong here?
I want to add the string in a order to the List. And this order i decided on the run time of the program. So i don't wanna use the "Add" method.
|
|
|
|
|
The Insert method doesn't work that way. MSDN[^] clearly states that if index is greater than Count, you will get an ArgumentOutOfRangeException exception.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
That doesn't seem to apply here.
|
|
|
|
|
PIEBALDconsult wrote: That doesn't seem to apply here.
You're right...and I just tried his code in a test application and it worked just fine.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
I just tried your code in a test application and it worked fine. Is this the actual code you are having problems with? Could you possibly be trying to skip indexes?
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
dipuks wrote: List<string> myList = new List<string>;
That doesn't even compile. It should be:
List<string> myList = new List<string>();
As Scott pointed out, the exception does not occur in the scenario that you describe. It's hard to find a problem in the code that you are using, when you are posting some other code that you are clearly not using...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I think the reason why your second insert is not working because index 1 is not yet created.
Maybe try to use add instead of insert then sort the content of the generic list.
Your code is not compiling because you have a missing parenthesis in instance creation of generic list.
List<string> myList = new List<string>();
Regards,
|
|
|
|
|
Hi,
i heard here in the forum about killing objects.
What is the advantage to me of doing so? free ram?
if a have a string object (or other) and i know i won´t use it anymore can i kill it? what in for me? ram? how to kill it?
thanks
|
|
|
|
|
Objects are reference counted in C#. The only thing you need to worry about killing are objects that have a Dispose method.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi,
I have been making some C# + SQL server applications.
I display and edit data in the same forms/pages.
I know i can make it prettier using crystal reports.
What is the best article here in code project about crystal reports or a good free tutorial to download in the www?
Thanks
|
|
|
|
|
It is possible to find good articles, but most helpful one is the Crystal Reports' own help file.
I suggest reading that one first.
www.businessobjects.com also has many samples that can be downloaded.
Good luck...
|
|
|
|
|
hi
i wanna know how do u retrieve information about system through C#
thanks
|
|
|
|
|
You didn't say exactly what information you want to get. So this will give you just about everything.
using System.Reflection;
. . .
Type t = typeof(System.Windows.Forms.SystemInformation);
PropertyInfo[] pi = t.GetProperties();
for (int i = 0; i < pi.Length; i++)
Console.WriteLine(pi[i].Name + " = " + pi[i].GetValue(null, null));
Cheers!
Marshall
If you continue to do the same things you always did, don't be surprised if you get the same results you always got.
|
|
|
|
|
|
I need to create an instance of FileSystemEventHandler inside a function, using a parameter passed into that function. FileSystemEventHandler takes an Object type that represents the method called by the FileSystemEventHandler delegate.
This would be easy with C++ since I can use a pointer to a method, but I'm lost in how to do it in C#. How can I pass this into my function so I can create the instance?
For example: Where OnChanged is the method for the delegate to call.
private void CallingFunc()
{
MyFunc(OnChanged);
}
private void MyFunc(SomeType theMethodToCall)
{
FileSystemEventHandler(theMethodToCall);
}
TIA
|
|
|
|