|
If you can take help of SqlDataReader it might help you to do this. it has function call HasRow.....
I hope can help...
Thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
Hi,
I am just starting to use gridview and have encounter problem when using it. I have 2 columns for my gridview which is the product number and product description.
I would have to get the old product number so that I can update the database with the latest record. Would appreciate if someone can help me with this.
Thanks in Advance.
Regards,
Jo
|
|
|
|
|
Could please tell me you want to update Gridview when you are Editing your OLD ProductID with New Product ID.
I mean edit mode.. or what
Thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
I have solved this problem already. Thanks.
Regards,
Jo
|
|
|
|
|
I have a struct which describes the attributes (properties, really) of a property. So:
struct TrackProperty(int PropertyIndex)<br />
{<br />
<br />
string Name;<br />
string DataTypeAsString;<br />
int MaxStringLength;<br />
int MinStringLength;<br />
int MaxIntValue;<br />
int MinIntValue;<br />
bool IsEnumerated;<br />
string EnumerationTypeAsString;<br />
<br />
}
Note that I am passing the name of the enumeration in the final field EnumerationTypeAsString (ie, "iTunesLib.VideoKind"). I want the code which instantiates this object to be able to use the name of the enumeration to get the valid values for this attribute of the specified property.
Is that possible? Can I go from a string containing the name of the enum type to the values in the enum itself? Or is there a better piece of data to use in that final field?
Having read MSDN on GetType(), and because the enum type I want to pass is from a DLL (they say don't use GetType on DLL assemblies), I think I want to pass the string description instead of calling GetType() myself. But how, on the other side, does the object instantiator go from the string to the Enum?
-- modified at 21:09 Tuesday 20th November, 2007
|
|
|
|
|
Dear JoeRip: Here is your answer.
Your final field should read:
Type EnumType;
In your constructor, fill it with:
EnumType = typeof(iTunesLib.ITVideoKind);
When the caller wants to use the Type you've passed, he'll do something like this:
TrackProperty tp = new TrackProperty(4);<br />
<br />
string names[] = Enum.GetNames(tp.EnumType)<br />
I want to think everybody who helped me. You've been great.
|
|
|
|
|
Many thanks.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi,
This might seem quite basic to you guys, but I'm not a c# developer (actually im not much of a developer at all!). I was looking to build a simple windows app that lets me link a couple of 2d shapes together with a line (think flowchart). I'd like to be able to drag these shapes around and have them stay linked - I've only done backend programming so I know very little about graphics/gdi+/activex etc. Somebody in my class is looking to expand on this but I'm only really interested in the basic principles as a learning excersise. What libraries should I look into?
Thanks
|
|
|
|
|
If you get the graphics object from your canvas (either the form or user control), you can call methods as follows...
Graphics g = ...;
g.DrawLine(...)
As for the shapes themselves, I would make a usercontrol called Shape, export an enumerated property that could be set to the shapes you want (say, RECT, TRI, and CIRCLE), then override the onpaint method to draw the shape you want within the bounds of that usercontrol...
g.DrawRectangle(...);
g.FillRectangle(...);
g.DrawPolygon(...);
g.FillPolygon(...);
Then you can connect whatever points you want with the drawline method. Hope this helps.
Jeff
|
|
|
|
|
Hi,
Thanks for your quick reply Jeff. Would that just connect up the two shapes at fixed locations and then redraw the line as/when a shape moves causing lots of flicker etc?
I'd like to expand on that sort of method to keep dynamically connected - like when you drag things around in visio but without using visio components. Maybe that is something outside of c#'s draw methods?
-Colm
|
|
|
|
|
for smooth rendering, you need to use a double buffer. That is, you draw to a canvass not being displayed, then swap that canvas with the one that is visible. I know that you can do that sort of thing with Win API using methods like BitBlt, CreateCompatibleDC, DrawLine, etc., but it gets extremely ugly (in the code) pretty fast. You could also manipulate a bitmap directly using pointers, which is the fastest way to do it, but again, is VERY unclean. I recommend instead you do it the easy (but less efficient) way mentioned here[^]. After you have it working, if you want some pointers on improving efficiency, start a new thread. Hope this helps,
Jeff
|
|
|
|
|
I'm in the process of writing a Visual Studio add-in. I wanted to have configuration information stored in a configuration file for my DLL. e.g. MyAddin.dll.config. I have created a custom section along with a section handler. I have tested the loading of the section handler from a test application and it works fine. When I do the same process in the VS addin I get the following error:
{"An error occurred creating the configuration section handler for copyright: Could not load file or assembly 'KLSoftware.VSEnhancer' or one of its dependencies. The system cannot find the file specified. (D:\\DotNET\\Solutions\\VSEnhancer\\VSEnhancer\\bin\\Debug\\KLSoftware.VSEnhancer.dll.config line 4)"} System.Configuration.ConfigurationErrorsException
I am loading the config using:
Configuration Myconfiguration = ConfigurationManager.OpenExeConfiguration ( Assembly.GetExecutingAssembly ( ).Location );
The configuration loads correctly and I can access Myconfiguration.AppSettings with no problem. The error occurs on the GetSection call listed below:
try
{
this.copyrightSection = Myconfiguration.GetSection ( "copyright" ) as CopyrightSection;
}
catch ( SystemConfig.ConfigurationErrorsException cex )
{
}
Any suggestions for handling this would be appreciated.
Ken
|
|
|
|
|
I have created a new eventlog on my windows box and also on a virtual machine that runs on my box. I am trying to log events into the event log using log4net and the eventlogappender. It works on the virtual machine, but not my box. I have full permissions on the event log. I also have a java application that is using log4j and can log events to the event log. I just cannot log the events when running my c# application. Any ideas would be appreciated.
A portion of my logging file that defines the appender is listed below
<appender name="AuditEventLogAppender" type="log4net.Appender.EventLogAppender" >
<logName value="MyEventLog" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5levelÀ%logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<logger name="com.mycompany.Audit" additivity="false">
<level value="ERROR" />
<appender-ref ref=" AuditEventLogAppender" />
<appender-ref ref=" AuditRollingFileAppender" />
<!-- defined and works in file above, did not list it-->
</logger>
thanks
I was able to turn on log4net debug and this exception was thrown:
[SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.]
I do not have permission for all the event logs, which will be the case when the application is deployed. I thought by setting the logname this would avoid this exception. Is there a way around this?
-- modified at 18:09 Tuesday 20th November, 2007
|
|
|
|
|
I think you forgot to check the "Ignore HTML tags in this message" box
Jeff
|
|
|
|
|
Hey guys,
I'm having a very strange problem with my windows service and a COM component. I have a wrapper class (which is a user control) that instantiates the OCX and adds some functionality (reverse geocoding) to it. If I instantiate the wrapper class during the OnStart event of the windows service, everything works fine. But, if I create a new instance of the wrapper class outside of this event (after the service has started), the services freezes at the line
((System.ComponentModel.ISupportInitialize)(this.axMapPro1)).EndInit();. The wrapper class works perfectly in my windows forms application.
I have no idea what could be causing this, as I'm not an expert on COM interoperability. Any of you geniouses out there have any bright ideas?
Mike
|
|
|
|
|
Hello Developer,
I need an urgent help.
I have a xml file that contains some Menu tag like this.
<?xml version="1.0" encoding="utf-8" ?>
<Menu>
<Group Flow="Horizontal">
<Item NavigateUrl="/Home.aspx" Width="53px" Height="22px" ImageUrl="/images/nav_home.gif" ImageOverUrl="/images/nav_home_over.gif" runat="server" >
</Item>
<Item NavigateUrl="/HRTools/EmployeeTools/EmployeeProfile.aspx?view=true" Width="135px"
Height="22px" BackColor="Transparent" ImageUrl="/images/nav_profile.gif" ImageOverUrl="/images/nav_profile_over.gif" runat="server">
<Group>
<Item NavigateUrl="/HRTools/EmployeeTools/EmployeeProfile.aspx?view=true" Text="Personal Information" runat="server" />
<Item NavigateUrl="/HRTools/EmployeeTools/PositionInformation.aspx?view=true" Text="Job Information" runat="server" />
<Item NavigateUrl="/SelfService/MyPay.aspx?view=true" Text="Compensation" runat="server" />
<Item NavigateUrl="/BenefitsAdmin/BenefitsSummary.aspx?view=true" Text="Benefits" runat="server" />
Now I want to read this file in my c# page with the following details.
I have different type of users some of them belongs to Manager label and some of them is Agency. Agency label user should not be able to see the menu that is for Manger label.Can somebody help me about this...
|
|
|
|
|
Its poor form to say you need urgent help. Also you don't specify the technology, other than c# page. Is it a webpage? Is it a Windows form? I assume the former.
Regardless though what you need is to construct the menu dynamically, from an xml file, or database, or where ever, based on the current users role. Or possibly have two Menu files that can be switched based on the user role.
only two letters away from being an asset
|
|
|
|
|
Hey Mark,
Thanks for your quick response.Yes it is a web page.
Actually I want to construct menu dynamically.My XML file contains those all the menus.But I want to display those menu based on users role.
The same I am also thinking but can you please give me some references code please it's really urgent and I am looking for your quick help.Your help is really appreciated..
Thanks
|
|
|
|
|
Actually I want two things
One: how to build hierarchical menu systems for web-based applications, and two: how to add security and auditing.
I am using ASP.net and C#.I have an XML file that contains all the menu items we just nned to add security and auditing..
|
|
|
|
|
have you looked at the ASP.NET menu control? Another possible way would be to use XSLT
only two letters away from being an asset
|
|
|
|
|
I tried with ASP.Net menu control I am able to display menu according to user but problem is that I have to use multiple xml files for this.Let say for manager I use manager.xml files and for Agency I used agency.xml file. But I want to use only one xml file.
Can you please give me some Idea about that..
Thanks,
|
|
|
|
|
I've used the search function to look for articles but didn't find what I needed.
I've been tasked with developing an application to run a simulation. The requirements are to allow one or more servers to run the simulation at the same time sharing the load. Are there any articles or books that can give me a headstart in designing this application?
Thanks!
- Darroll
Darroll
|
|
|
|
|
It depends on what you need help with. If you are looking for a way to efficiently split the workload, it will be hard to give you pointers without knowing the specific problem and how it can be easily divided into smaller tasks. If the problem is setting up the servers, how to connect to them, how to discover their current work loads, etc., then there is a lot of help to be had. Please be a bit more specific as to what kind of assistance you are looking for.
Jeff
|
|
|
|
|
My main concern at the moment is how to manage objects between instances of the servers. The simulation takes multiple vehicles buildings and people. all doing various tasks. There will also be resources that get consumed and created. My thougts were to devide the work load via regions. This way I can segment the load based on the number of objects in a region by resizing the regions. The design of the object menagment and also the best way to transfer and manage objects is what I am looking for.
Thanks!
-- modified at 15:03 Tuesday 20th November, 2007
Darroll
|
|
|
|
|
I would probably have both servers implement identical functionality, which is that either can be initially contacted with the full load. Then, that server delegates some work to the second machine. Use asynchronous web service calls with a delegate to return when the entire task is finished. The second machine can pass info back the same way (asynch calls). If security is an issue, encrypt and authenticate. Make sure that all your objects are serializable, and the easiest way to send would be via soap messages with the serialized object, or you can open a TcpConnection or SSL connection and get a stream from that. As far as object management goes, you will have to have two copies of each object: one on the client, and one on the server. If you find you don't need to keep an object, then pass it on a delete it. I feel like this isn't really helping at all, but I hope I am wrong and I have answered some of your questions.
Jeff
|
|
|
|