|
SELECT * FROM USER_TABLES
SELECT * FROM USER_VIEWS
SELECT * FROM USER_OBJECTS WHERE OBJECT_TYPE='PROCEDURE'
Free your mind...
|
|
|
|
|
I am writting a small application that works with remote server via http. My application sends a request and in return receives an xml file (i can access it via a string var.)
now I need to build a CheckedListBox with the data from this XML. Can someone suggest a simple way to arrange this and maybe give a sample?
my XML file looks like a lot of small containers that look like this (for each item):
<item>
<id>1</id>
<post_date>040104</post_date>
<subject>I posted a subject here!</subject>
<content>content is posted here</content>
</item>
<item>
I want to be able to build CheckedListBox with 4 rows: id, post_date, subject, content.
thanks a lot!
Alexander
|
|
|
|
|
First of all, design your XML document to reflect alternatives which are more like siblings. Because you have a fragment like:
<items>
<item>
<id>1</id>
<post_date>2004-01-03T00:00:00</post_date>
<!-- and the rest -- >
</item>
<item>
<id>2</id>
<post_date>2004-01-03T01:00:00</post_date>
<!-- and the rest -- >
</item>
</items> This implies that each item should be a separate row. This isn't absolute, but common. If you design your document like this, you could actually use DataSet.ReadXml and create a DataSet which is easily bindable to a CheckedListBox .
If you want to use your schema that you posted, you'll have to parse the XML document manually and create an IList or IListSource implementation. The easiest way would be to use an ArrayList , which implements IList . You can then use this object with the CheckedListBox.DataBindings property (if memory serves me correctly), or enumerate the list and add each item to the CheckedListBox.Items property. If you use the latter method, you can forego the ArrayList and just add the different XML elements to the CheckedListBox.Items property in the first place.
For information on multi-column CheckedListBox es, see the CheckedListBox.MultiColumn property documentation, which inherits from the ListBox control class.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
well, my XML file looks like what you have shown above: all <item></item> are stored withing one <news></news> so it looks like:
<news>
<item>
</item>
<item>
</item>
</news>
I made a mistake, I want to show the data in a datagrid, not a checkedlistBox. The problem is that this XML is actually a string...
I created a new dataset. how can I make dataset.ReadXml() read from a string?
many-many thanks!
Alexander.
|
|
|
|
|
dophka wrote:
I want to show the data in a datagrid, not a checkedlistBox.
Good, a DataGrid is easier to data-bind since you only have to use the DataSource property. You should also consider using the DataMember and TableStyles properties. See the SDK documentation for details or play around with the designer in VS.NET a little. It's not too difficult.
dophka wrote:
I created a new dataset. how can I make dataset.ReadXml() read from a string?
You'll need to read the fragment as a TextReader unfortunately. Let's say your XML fragment is in a string variable named xml :
StringReader reader = null;
DataSet ds = null;
try
{
reader = new StringReader(xml);
ds = new DataSet("news");
ds.ReadXml(reader);
}
finally
{
if (reader != null) reader.Close();
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
thanks a lot for your explanations!
how I have done reading the xml thingy and I am sorry for asking, but then what? do I create another dataSet, add columns and then fill it with the data from the dataset that grabbed the xml content?
can you please please please walk me little further?
thanks!
Alexander
|
|
|
|
|
I'm the kind of guy that would rather teach a man to fish than give him a fish. So, read the documentation for the DataGrid . You already have your DataSet , so you assign that to the DataGrid.DataSource property and set the DataGrid.DataMember property to the table name you want to bind to. Columns are automatically created for each column of that table, but you can control this with the DataGrid.TableStyles property.
Try doing all this in VS.NET using the designer. Create a new DataSet schema then use the Data toolbox to add a new DataSet object. Add a DataGrid to your form or control and play around with some of the properties. Reading the documentation will fill in the details, which are important to understand.
There are also many great articles on data-binding here on CodeProject. Just use the search box toward the top and use generic terms like "DataSet" or "DataGrid". I'm sure you'll find plenty.
Besides, going into any great deal really isn't meant for the forums. With all the possibilities, this is better discussed in an article. Always be sure to read the documentation, though. It should be your first stop for any questions.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
it seems to be helping a lot!
I finally made the grid how my data and feel very happy about that. I tho have a couple of last (you wish ) things to ask (something I didn't yet find in the properties):
when the grid comes out it has four columns as expected but how do I make them fill all the space horizontally? the actual grid sits in the left upper filling only about 50% of vertical space.
when the text in a column does not fit the grid window horizontally, is there a way to make it put it into a new line? like excel does it? o.w. avoid horizontal scroll bar?
and again - thanks a lot!
Alexander...
|
|
|
|
|
dophka wrote:
(something I didn't yet find in the properties)
Don't be a drag-n-drop programmer - read the documentation for the DataGrid You'll find a lot more is possible than what the properties provide (some properties are browsable in the designer, and then there's all the methods that you won't see...)
dophka wrote:
when the grid comes out it has four columns as expected but how do I make them fill all the space horizontally?
This is perhaps the biggest problem with the DataGrid . There's really nothing you can do but resize the column programmatically. I'm sure I've seen a couple articles on this here on the CP site. Just try a search.
dophka wrote:
when the text in a column does not fit the grid window horizontally, is there a way to make it put it into a new line? like excel does it?
First of all, you must understand that Excel is a spreadsheet control - not a grid (just so you don't get any other crazy ieas in your head! )
Second, you can create a custom DataGridColumnStyle class that allows you to edit text in multiple lines, but the display of the values is dependent on the DataGrid . To my knowledge, there is no way to get the text to display in multiple lines when not in edit mode.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
can any body tell me link where can i find objective question related to asp.net and csharp
r00d0034@yahoo.com
|
|
|
|
|
What do you mean? Are you asking where you can ask a question about an object for ASP.NET and C#? You can ask here or in the ASP.NET forum - see the links above.
The word "objective" means that a statement is not biased in any way. For a question, this really doesn't make any sense.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi All,
here is a code snippet from my mail program.
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send (myemail);
myemail is an object of MailMessage.
If i run this program for the first time in Visual Studio there is an error saying CDO.Message is not accessible.
When it runs all the mail messages are stored in c:\inetpub\mailroot\queue
they do not reach there destinatin. They all are stored in my computer only.
Please someone tell me how to solve this.
WIll be eagrly waiting for the answer.
|
|
|
|
|
Can you post the details of how you're setting up myemail? Make sure the From property is set. Also, use a try/catch block to capture the exception and look for InnerExceptions. An InnerException may give more details as to the nature of the problem.
|
|
|
|
|
Thanx for replying!
i have used this code ..
private void button1_Click(object sender, System.EventArgs e) {
MailMessage myemail = new MailMessage();
myemail.From ="Tushar";
myemail.To ="a_tushar@hotmail.com";
myemail.Subject ="Test";
myemail.Body ="How are you ";
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send (myemail);
}
using this all my mails are stored on my computer only they are not being delivered at a_tushar@hotmail.com
|
|
|
|
|
Well, the from should be an e-mail address.
|
|
|
|
|
This isn't his problem. As Mazdak said, we answer his question several days ago. His problem is that he hasn't configured the SMTP Virtual Server in the Internet Information Manager. I gave him pointers how to get started and told him to read the help, but he obviously hasn't.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
We answer you some days before. Look at those links and see how you should send email by C# and stop reposting the same question please.
Mazy
No sig. available now.
|
|
|
|
|
Once again I'll tell you that you're code isn't the problem - the problem is that you have NOT configured the SMTP Virtual Server at all or correctly. Again, go to Internet Information Manager in your Administrative Tools folder in the Control Panel and find the SMTP Virtual Server. You have to configure this to send mail using SMTP. It isn't setup by default but there's very little to do. Just read the help files which should be easy to understand.
Once again - as Mazdak also said - this is not a problem with your code, hence quit posting it in the C# forum. It is a problem with your machine configuration of the SMTP Virtual Server. If you need additional help, go to http://support.microsoft.com[^]. It really isn't hard to configure, though.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hello again guys.
I have a new problem.
I made a button, which was had a keypress event and it worked perfectly.
Now I've a panel and it hasn't keypress event among its public stuffz.
How can i add my keypresseventhandler function to this panel?
MS Visual Studio.NET 2003
C#
|
|
|
|
|
I may be wrong about this, but I think you have to add the handler to the Form object that contains the Panel, and test if the Panel has the focus.
|
|
|
|
|
Well, i tried to add the handler to the form object, but I can't.
Here's what i did:
public Form1()
{
...
this.KeyPress += new KeyPressEventHandler(this.keypressed);
...
}
void keypressed(Object o, KeyPressEventArgs e)
{
switch (e.KeyChar)//Here I made a breakpoint, but the debugger doesnt reach this point, when I
//press a button...
{
...
}
}
What's the problem?
MS Visual Studio.NET 2003
C#
|
|
|
|
|
Make sure the Form .KeyPreview property is set to true . There are some other good notes in the sdk documentation for Form .KeyPreview that you might want to check out.
I hope this helps--
--mike
|
|
|
|
|
Yeah, thanks.
That works.
MS Visual Studio.NET 2003
C#
|
|
|
|
|
I've started getting a very strange exception in my program.
An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module.
That happens sometimes when a window is created (not a specific window, has happened with messagebox and my own forms).
I am using .Net version 1.1. This is my first app with 1.1, so maybe there was some important detail I missed that has changed from 1.0 to 1.1?
I know threads and UI can cause a mess if done badly, but I am not doing any threading at all.
It seems that before the exception occurs, a new thread with no name is created.
VS cannot tell me anything about the thread: there is no call stack, the stack frame selector is unclickable... nothing.
|
|
|
|
|
Many threads are created that handle various things, like painting a control or for asynchronous operations. You never know.
Make sure you're compiling a debug build. There's other reasons you might not be able to use some of the debugging tools (threads are always funny when it comes to that), but just to eliminate the obvious I mentioned that.
If you think it has something to do with threading, check that your application's Main entry point is attributed with the STAThreadAttribute , which is the main UI thread. Usually, though, you get different errors if your application is started in anything other than an STA.
As far as changes 1.0 to 1.1, there really isn't much besides new methods and a few new classes, and a few methods and properties that are now obsolete - nothing conceptual is mentioned, though.
All I can think is to click on the Debug->Exceptions menu and break on all exceptions. Changes are that you'll end up looking at assembler code, but it should give you some stack frame if the debugging symbols are loaded. If you're not using a checked build of Windows, they are probably stripped. VC++ does install some program database (pdb files), but not for the core libraries. If you dig around though, you should at least be able to determine which library you're in. That could help solve the problem since most libraries are pretty specialized.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|