|
|
|
This would be more like a file based database like Acess that is installed on individual desktops.
|
|
|
|
|
I need to loop through each row in the web datagrid that has bound columns
can some one help me with this. ?
based upon a value in column 4 of the datagrid I need to change the back color of that row, and then move to the next row until finished processing all the rows.
thanks
|
|
|
|
|
Do an onitemdatabound handler, then use FindControl to find the item you want to inspect/modify.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
The same question, but with a Windows Form DataGrid control?
Thanks,
Enrique.
|
|
|
|
|
Can anyone tell me the best way to do this?
Form1 has a listview that pulls data from a sql table and displays it in the listview.
From Form1, how can i call a class that would make the SQL connection and run a query that would display my data to Form1?
basically, i have a lot of Forms that individually make a SQL connection, but in the event of having to change SQL servers, i dont want to have to go into all 20 of these forms to change the SQL Connection string to point to a new server.
Form1
-----
<br />
private void listfromDB()<br />
{<br />
string sqlString = "select * from table";<br />
mySQLClass getSQLdata = new mySQLClass();<br />
getSQLdata.SQLdata(sqlString);<br />
<...code to add data from query to listview...><br />
}<br />
Class1
------
<br />
public giveSQLdata(string _sqlString)<br />
{<br />
string sqlCon = "workstation id=LOCALHOST;packet size=4096;...etc";<br />
SqlConnection sqlConnect = new SqlConnection(sqlCon);<br />
SqlCommand cmd = new SqlCommand(_sqlString, sqlConnect);<br />
sqlConnect.Open();<br />
SqlDataReader dr = cmd.ExecuteReader();<br />
return something...<br />
}<br />
i'm new to this and need help...i freely admit this.
thank you so much for your help.
.gonad
|
|
|
|
|
A number of solutions come to mind.
What I normally end up doing is adding information to the app.config or web.config that has the name of the SQL Server. Then in my .NET application (of what ever type) I create a class that I use to access the config file. This class will build a connection object for me based on the contents of the config file.
The class might look something like this:
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace MyNamespace
{
public class ConfigSettings
{
public static SqlConnection DatabaseConnection;
{
get
{
string server = ConfigurationSettings.AppSettings["SqlServer"];
string database = ConfigurationSettings.AppSettings["Database"];
string connectionString = string.Format("Server={0};Database={1};uid=???;pwd=???", server, database);
return new SqlConnection(connectionString);
}
}
}
}
The corresponding config file will look something like this:
<configuration>
<appSettings>
<add key="SqlServer" value="ServerMachineName" />
<add key="Database" value="Northwind" />
</appSettings>
</configuration>
Does this help?
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums Upcoming talk:
SELECT UserName, Password FROM Users
-- Getting unauthorised access to a SQL Server, and how to prevent it.
|
|
|
|
|
Colin Angus Mackay wrote:
Does this help?
Well, even if it doesn't help him, It sure helped me! It's scary how the obvious sometimes escapes me.
Thanks Colin!!
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
|
yes!
thank you very much for this. i haven't used the app.config before so this opens a lot of doors for me.
thanks for the insight!
gonad.
|
|
|
|
|
Two general questions...
First, I have SEVERAL system.Diagnostics.process events running in just ONE menu click event, but the thing is that only the FIRST process gets run, while the other processes are ignored. What is the reason for the other processes being ignored? Do I need to implement each of the processes using a multi-threaded approach? If so, is there a good article written on all of the steps required for multi-threading?
Second, I am implementing a C# windows application that accesses several graphics files based upon the menu item that is selected by the user. The problem is that when a different menu item is selected, the graphics items are NOT RELEASED, and thus they cannot be overwritten with graphic file replacements. The error message thrown is that there is a file sharing error. Is there a way that I could somehow RELEASE the graphics programmatically so that there would not be a file sharing error thrown, and if so, what is the syntax?
I would imagine that it would need to use a foreach loop with relation to a directory and would somehow utilize the control.Dispose() method ie.
string strDirectory = System.IO.Directory;
foreach(Control control in strDirectory)
{
control.Dispose();
}
Am I on the wrong track, or is there a way of RELEASING the files so that they are no longer in SHARE MODE so that they could be overwritten? Would appreciate some further assistance.
|
|
|
|
|
new_phoenix wrote:
First, I have SEVERAL system.Diagnostics.process events running in just ONE menu click event, but the thing is that only the FIRST process gets run, while the other processes are ignored.
Without seeing your code that launches all this stuff, it's impossible to tell you what your doing wrong. You should be able to launch any number of processes without spawning them on extra threads.
new_phoenix wrote:
Second, I am implementing a C# windows application that accesses several graphics files based upon the menu item that is selected by the user. The problem is that when a different menu item is selected, the graphics items are NOT RELEASED, and thus they cannot be overwritten with graphic file replacements.
You're running into the issue where if you tell an Image object to load an image from a file, the Image object maintains a lock on that file until the Image object is disposed. To work around this, see this[^] article on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak:
Interesting article about graphic file locking using the Image.FromFile() method versus FileStream. Makes me wonder why Microsoft would set up the possibility of creating this issue in the first place. Also, thanks for letting me know that I do not need to go into spawning threads to manage the processes as well. Could the problem of process management be that the first process needs to be killed before it could progress to the next process? Thanks again.
|
|
|
|
|
new_phoenix wrote:
Could the problem of process management be that the first process needs to be killed before it could progress to the next process?
Only if you're telling it to wait for the process to complete. By default, it will launch process after process without waiting. Like I said, we'd need to see your code that launches these.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
We have a .net 1.1/c# windows application. We install and everything is fine. The first time we try to run the application though it does a repair on itself and the following message appears in the application event log on the computer.
Detection of product '{32214061-AA74-405B-81B2-76E0213EFF49}', feature 'DefaultFeature', component '{9F3FC1C9-7A15-4F58-9117-AB0A91F57675}' failed. The resource 'C:\Program Files\Common Files\Crystal Decisions\1.0\Bin\pg32conv.dll' does not exist.
Weird thing is that this dll DOES exist - we checked for it before starting the application.
Any ideas on how to solve this? The repair messes up some configuration files we have so we need to stop it.
|
|
|
|
|
If this is happening after the app is installed using Installshield, then i have seen the same types of things. InstallShield does the repair on a file and it then also messes up alot of configuration too.To stop this for testing we had to disable the Windows Installer service after the app was installed. there is suppose to also be a flag to turn this off in the install script too, but we could not get it to work correctly.
Steve Maier, MCSD MCAD
|
|
|
|
|
we are actually not using InstallShield - just using the .msi and setup.exe. Maybe I will look for the script you referred to - thanks for the input.
|
|
|
|
|
Hi all,
I've created a UserControl having a picturebox control on it. Then I added my UserControl to the Windows Form and also added the _Click event. My problem is; when I click the UserControl the event is fired just fine but when I click the picturebox on the UserControl - nothing happens. What would you suggest?
Thanks
Radgar
|
|
|
|
|
Add an event handler to your UserControl that catches the Click event of the contained PictureBox and raises the Click event of your UserControl.
YourUserControl : UserControl
{
private PictureBox pictureBox1;
...
this.pictureBox1.Click += new EventHandler(pictureBox1_Click);
...
private void pictureBox1_Click(object sender, EventArgs e)
{
this.OnClick(e);
}
}
www.troschuetz.de
|
|
|
|
|
Thank you Stefan but I did it yesterday by adding a public delegate & event handler. Your way is much easier. Thanx!
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
I was following this tutorial
http://www.codeproject.com/dotnet/mgrmsmq.asp
but I don't seem to have System.Messaging. Can someone explain what's going on? I thought that was standard?
Thanks a lot,
Jim
|
|
|
|
|
It will be in a dll you need to import. Right click on 'references' for your project, click on Add Reference, and choose System.MEssaging from the .NET list.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks you SO much, I am a COMPLETE idiot -_-
Jim
|
|
|
|