|
Hi. I am getting data from a MySql Datasource like this:
string hostname = "localhost";
string username = "root";
string password = "0000";
string mySelectQuery = "SELECT * FROM report;";
MySqlConnection myConnection = new MySqlConnection("server=" + hostname + ";uid=" + username + ";pwd=" + password + ";database=elearning;Charset=latin1;");
MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
chart1.DataSource = myCommand;
chart1.Series["Series 1"].XValueMember = "ExamNumber";
chart1.Series["Series 1"].YValueMembers = "Percentage";
chart1.DataBind();
I am using the chart control. I got yesterday so probably i should return it before the warranty expires . There is no error but the chart just won't show when i run the application. What could be wrong.Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Wamuti wrote: I am using the chart control. I got yesterday
so ask your question where veer you got the control from.
you did not even tell us which chart control it is, how could we help you at all?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
how to convert (or Cast) string to C# classess
|
|
|
|
|
Hi,
I'm not sure what you mean exactly. Do you want to create an object from your string by deserialization? If yes, take a look here:
Object Serialization using C#[^]
If not please let me know the C# class you want to convert your string to.
Regards
Sebastian
|
|
|
|
|
I want to convert string to (Point,Font,Color,... ) ?
|
|
|
|
|
Okay, and how does the string look like? E.g. Point(10,20)? I guess you have to write your own method of converting the string to an object.
|
|
|
|
|
no it looks like
10,20
for font :
Arial
for location :
15,19
|
|
|
|
|
And where does the data come from? I mean it could be very difficult to build an algorithm analysing the string itself it is a location or a font name or a color. This could end up in writing a compiler...
|
|
|
|
|
jojoba2010 wrote: Point
System.Drawing.PointConverter
jojoba2010 wrote: Font
System.Drawing.FontConverter
jojoba2010 wrote: Color
System.Drawing.ColorConverter
|
|
|
|
|
looks like you need xml deserialization. That is, having an object represented as an xml string, deserialize it in the proper class.
Is that the case?Best regards,
Jaime.
|
|
|
|
|
No
I have string and want to cast it to (color,point,font,...)
|
|
|
|
|
jojoba2010 wrote: I have string and want to cast it to (color,point,font,...)
You cannot do this, a string is just a collection of characters. If you want to create some other object from it then you need to parse the string, extracting the relevant fields and create new objects based on that data.
Read the documentation on what casting is, it does not convert one object to another.MVP 2010 - are they mad?
|
|
|
|
|
Richard MacCutchan wrote: MVP 2010 - are they mad?
Nope i don't think so! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You are too kind my friend. MVP 2010 - are they mad?
|
|
|
|
|
what actuallly coming into your string! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
From what I read in the thread you're not really helpful in providing information.
Note that we don't have any background on what you need to do or what you've done so far.
Please elaborate a little on the problem. Where does the input come from? In what format is it set (XML, flat file, CSV,...)? Is there metadata included? What different types of 'classes' are we talking about? etc...
If you want help you'll need to be more specific.V.
|
|
|
|
|
The word you are looking for is "parse". Many classes have a "Parse" method. For example:
int x = int.Parse("1");
To parse Point strings, you can use the System.Drawing.PointConverter class. For other classes, find the parse methods or create them yourself.
|
|
|
|
|
Hi..
I'm using sql server 2005 Standard Edition and vs 2005
im trying to get database backup & restore with c# coding its succesfull run in my machine.(Using smo namespace)..my machine are installed management studio so smo retrive server name and DB..
But when i was create exe this backup application and run client machine its not run.. Bcoz client machine only installed express edition not in management studio.. Client machine have some software with Database(path c:\Program Files\Test\) in this case how can i get backup & Restore in client machine...?
Pls help me..?
|
|
|
|
|
you can take help from Here[^]
|
|
|
|
|
Also im trying this..
That's also using smo retrive server name and DB with connect management studio..
But I need all project DB backup without installed management studio, only installed express edition..Bcos client machine have express edition not in management studio..
Any idea.
|
|
|
|
|
PropertyInfo propertys = control.GetType().GetProperty("Font");
tc = System.ComponentModel.TypeDescriptor.GetConverter(propertys.PropertyType);
propertys.SetValue(control, (<big><code>?</code></big>)"Arial", null); modified on Tuesday, February 9, 2010 2:10 AM
|
|
|
|
|
|
Hi
I'm newbie in NHibernate. I've downloaded example from: https://www.hibernate.org/379.html[^]
I can retreive data from database via iquery but i have a problem when I try save data.
Here is code:
Supplier supplier = new Supplier();
supplier.Name = "Supplier5";
Manufacturer manufacturer = new Manufacturer("manufacturer5");
Product product = new Product();
product.Name = "product5";
product.Supplier = supplier;
supplier.ProductList.Add(product);
manufacturer.ProductSet.Add(product);
product.ManufacturerSet.Add(manufacturer);
ITransaction transaction = Session.BeginTransaction();
try
{
Session.Save(supplier);
transaction.Commit();
}
catch (NHibernate.HibernateException nexp)
{
}
I've got an error:
error performing isolated work
InnerException: {"Object reference not set to an instance of an object."}
Here is mapping file supplier.hbm.file:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" default-access="nosetter.camelcase">
<class name="NHibernateExampleApp.Supplier, NHibernateExampleApp" table="SUPPLIER" lazy="true" mutable="true">
<id name="SupplierId" unsaved-value="0" column="ID_SUPPLIER" type="System.Int32">
<generator class="hilo">
<param name="table">hibernate_unique_key</param>
<param name="column">next_hi</param>
<param name="max_lo">10</param>
</generator>
</id>
<bag name="ProductList" table="PRODUCT" cascade="all" fetch="join" inverse="true">
<key column="FK_SUPPLIER" />
<one-to-many class="NHibernateExampleApp.Product, NHibernateExampleApp" />
</bag>
<property name="Name" column="NAME" not-null="true" type="System.String" />
</class>
<query name="suppliers">from Supplier</query>
</hibernate-mapping>
StackTrace:
" at NHibernate.Transaction.AdoNetTransactionFactory.ExecuteWorkInIsolation(ISessionImplementor session, IIsolatedWork work, Boolean transacted)\r\n at NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.ExecuteWorkInIsolation(ISessionImplementor session, IIsolatedWork work, Boolean transacted)\r\n at NHibernate.Engine.Transaction.Isolater.DoIsolatedWork(IIsolatedWork work, ISessionImplementor session)\r\n at NHibernate.Engine.TransactionHelper.DoWorkInNewTransaction(ISessionImplementor session)\r\n at NHibernate.Id.TableGenerator.Generate(ISessionImplementor session, Object obj)\r\n at NHibernate.Id.TableHiLoGenerator.Generate(ISessionImplementor session, Object obj)\r\n at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.Save(Object obj)\r\n at NHibernateExampleApp.Form1.NHTest() in D:\\rg\\proj_CSharp\\NHibernateExampleApp\\NHibernateExampleApp\\Form1.cs:line 136"
I can see that is a problem with hilo.
I have table: hibernate_unique_key
Column next_hi has value 0
Could someone help me?
ThanksI
modified on Tuesday, February 9, 2010 1:44 AM
|
|
|
|
|
Ok, sorry, problem is resolved. I
|
|
|
|
|
Hello,
Datagridview OrderView;
In the above Datagridview my 2nd column is a checkboxcolumn
Rectangle contentBounds = OrderView.Columns[2].CellTemplate.GetContentBounds(0);
But I cant get the contentBounds of the check box
I m getting the rectangle as x=0 y=0
But actually the checkbox column is made and checkbox appears in the first row.
How can I get the bounds ?
thank you
|
|
|
|