|
I guess the real question is, why did you expect it to be otherwise ? .NET assemblies are not registered like COM dlls are, and the system is not going to search the whole HDD for your file. If it did, what would it do if it found more than one of the same name.
As someone else said, the 'new' feature of .NET is to discard the idea of central registry and go back to having all the files local, so each exe has it's own copies of the libraries it needs.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi..
I am making a VS.Net2003 windows application.Iam trying to create a typed dataset without using the usual way (Data menu>generate dataset) because I don't want to create the dataset and fill it in the Form class.So I have added a new dataset visually (Right click the project then Add New Item then choosing DataSet) but when I drag the table to the designer panel of the DataSet XSD file the schema of the table appears but I didn't find any adapters generated.Then I created a SQLDataAdapter to fill the typed dataset and then give it to the datagrid as a datasource but nothing appeared in the datagrid.Iam trying to display 2 columns in the datagrid using DataGridTableStyle(DataGridBoolColumn and DataGridTextBoxColumn).I hope that you can help me to solve this problem.
I am too late but i will never give up
|
|
|
|
|
VS2003 doesn't generate table adapters for your dataset. The only way to get one generated for a specific table, is to create a new component. After you created the component, you need to show the designer of the component and drag-and-drop a data adapter onto the designer. Now you can configure it using the contextmenu.
Of course you can move over to VS2005 or C# 2005 Express edition. This contains the functionality you need and many other things that could make your life easier. However it depends on the requirements you have for the application if changing to C# 2005 is an option.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Thank you very much.I tried it as you told me and it works.I tried to use the same code that was added automatically to fill the dataset from a separated class but it didn't work and I dont know how to save changes in the datagrid to the database because I didn't add an object of the dataset to the designer using the code (adapter1.update(dataset1))?
I am too late but i will never give up
|
|
|
|
|
Hi ,
I want to add a new user account to windows using C#, its a stand alone pc , not on domain , no AD. I found some examples on internet , which uses "Netapi32.dll" , and its not working for me. I cant seem to get error code that why its failing !!!
Is there any .NET API to add user ?
Or any working example of using Netapi32.dll API ?
Thankz
ZINK
|
|
|
|
|
|
Thanks Giorgi
-- modified at 15:34 Saturday 23rd June, 2007
|
|
|
|
|
I'm trying to learn How to use Databases from a book,it gives me this code to input and it runs fine except it doesn't write any of the lines to the console as it should. I dont get any error messages. I moved some of the code around and the problem seems to be that it stops processing after the conn.Open() method. Anybody know why or how to fix it?
using System;
using System.Data;
using System.Data.SqlClient;
namespace Chapter04
{
class SqlServerProvider
{
static void Main(string[] args)
{
// Set up connection string
string connString = @"
server = .\sqlexpress;
integrated security = true;
database = northwind
";
// Set up query string
string sql = @"
select
*
from
employees
";
// Declare connection and data reader variables
SqlConnection conn = null;
SqlDataReader reader = null;
try
{
// Open connection
conn = new SqlConnection(connString);
conn.Open();
// Execute the query
SqlCommand cmd = new SqlCommand(sql, conn);
reader = cmd.ExecuteReader();
// Display output header
Console.WriteLine(
"This program demonstrates the use of "
+ "the SQL Server Data Provider."
);
Console.WriteLine(
"Querying database {0} with query {1}\n"
, conn.Database
, cmd.CommandText
);
Console.WriteLine("First Name\tLast Name\n");
// Process the result set
while(reader.Read()) {
Console.WriteLine(
"{0} | {1}"
, reader["FirstName"].ToString().PadLeft(10)
, reader[1].ToString().PadLeft(10)
);
}
}
catch (Exception e)
{
Console.WriteLine("Error: " + e);
}
finally
{
// Close connection
reader.Close();
conn.Close();
}
}
}
}
|
|
|
|
|
The code looks fine, how exactly does it stop?
It could be that you are getting time-outs on the connection.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Hello Coders!
appologies if this is in the wrong forum, as it involves C# and XAML. Also, im a noob which cant be helped.
Im attempting to create a viewer application to display information in an XML file.
Whenever i assign data to a class variable, like so:-
PortfolioItem.m_ID = xID.GetAttribute("id")
i get the following error message:-
http://www.klog.co.uk/images/xamlerror.jpg
I have my classes in a separate cs file, and all my coding is being done under the public Window1() method in the windows1.xaml.cs code behind file
any help would be fantastic
Kris
|
|
|
|
|
All that can be devised from that screenshot is that an error occurred when an instance of Window1 was being created. Check throught the construction code etc for anything that'd throw an exception.
|
|
|
|
|
This is a typical case where the inner exception is the only source of information.
Can you try again and check the inner exception of the exception? Usually this gives the real error.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Hi,
I am having some confusion of abstract methods and inheriting.
Lets take my example:
abstract class MyClass
{
public abstract void Method1();
public abstract void Method2();
}
class YourClass : MyClass
{
public override void Method1()
{
// Implementation here
}
public override void Method2()
{
// Implementation here
}
}
Everything I understand till the next part:
MyClass mc = new YourClass();
Why I do not understand it is because if YourClass has extra methods, then how can it save that instance in mc?
Please can someone explain this to me in a little more detail?
Regards
ma se
|
|
|
|
|
ma se wrote: MyClass mc = new YourClass();
Why I do not understand it is because if YourClass has extra methods, then how can it save that instance in mc?
Please can someone explain this to me in a little more detail?
Sure. Classes are reference types. So MyClass mc; only creates "pointer" to MyClass.
new YourClass() creates instance of YourClass somewhere in memory and returns reference (again, think pointer) to to it. It should be clear now that MyClass mc = new YourClass(); does not save instance of YourClass IN mc - it assigns reference to YourClass. That's why it fits.
I am not 100% correct now but you should get the idea.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Adding to that, you can save a reference to a very specialized thing into
a very dumb thing, so it is perfectly OK (but maybe not very useful) to write:
object myThing=new VerySofisticatedFormWithLotsOfFeatures();
unfortunately you can't do much more to myThing than call its ToString() method;
unless you cast it again as in:
VerySofisticatedFormWithLotsOfFeatures aha=
(VerySofisticatedFormWithLotsOfFeatures)myThing;
aha.NowICanShowOfThoseFancyThings();
|
|
|
|
|
Hello!
How can I determine at runtime if my .NET is running as a Unicode Windows application?
For example, if I run my application on Windows 98, all the window controls are used in ANSI mode. If run on Windows 2000 and higher, the Unicode versions of the window controls are used. Is there a way to see which version is currently used?
Thanks and best regards
Dominik
|
|
|
|
|
You can find out on which OS your application is running by System.OperatingSystem and System.Environment classes
|
|
|
|
|
Dear all,
I have the following code :
private void button2_Click(object sender, EventArgs e)<br />
{<br />
<br />
<br />
NpgsqlConnection conn = new NpgsqlConnection("Server=192.168.24.24;Port=5432;User Id=postgres;Password=S3cr33t;Database=Database;");<br />
<br />
NpgsqlDataAdapter mySqlDataAdapter = new NpgsqlDataAdapter("Select * from points", conn);<br />
DataSet myDataSet = new DataSet();<br />
DataRow myDataRow;<br />
<br />
<br />
NpgsqlCommandBuilder myCommandBuilder = new NpgsqlCommandBuilder(mySqlDataAdapter);<br />
<br />
mySqlDataAdapter.Fill(myDataSet, "points");<br />
myDataRow = myDataSet.Tables["points"].NewRow();<br />
<br />
<br />
myDataSet.Tables["points"].Rows.Add(myDataRow);<br />
<br />
foreach (DataRow myDataRow1 in myDataSet.Tables["points"].Rows)<br />
{<br />
myDataSet.Tables["points"].Rows[0]["track_easting"] = "665544";<br />
}<br />
mySqlDataAdapter.Update(myDataSet, "points");<br />
}
This code 'appears' to run fine. However, if I check back in the database, it has only updated the first row. But I want it to update every single row in the Dataset / Database. So I dreamed up the Foreach statement but I think I'm using it wrong. Can someone point me in the right direction ?
Cheers
|
|
|
|
|
Rick van Woudenberg wrote: myDataSet.Tables["points"].Rows[0]["track_easting"] = "665544";
[0] ?
|
|
|
|
|
Your previous posters point is here!
foreach (DataRow myDataRow1 in myDataSet.Tables["points"].Rows)
{
myDataSet.Tables["points"].Rows[0]["track_easting"] = "665544";
}
You are iterating through all rows, but only updating the first row(ie Rows[0])
try
foreach (DataRow myDataRow1 in myDataSet.Tables["points"].Rows)
{
myDataRow1["track_easting"] = "665544";
}
|
|
|
|
|
Sweet .. that is something that I am going to try. Luc ( in the previous reply ) pointed me in exactly the same direction, So after a little bit of tinkering, I came up with this :
for (int x = 0; x < myDataRow.Table.Rows.Count; x++)<br />
{<br />
myDataSet.Tables["points"].Rows[x]["track_easting"] = "665544";<br />
}
Is there a significant difference between the two ?
Kind regards,
|
|
|
|
|
Sure, readability is much better with foreach, as pprice has shown;
and readability or clarity leads to better maintainability.
Performance wise I dont expect a significant difference.
|
|
|
|
|
The main differenc eappears to be your understanding of foreach. In your new version you are using a for each loop which is fine, but for simplicity you could revert to the for each loop
here is my original example
foreach (DataRow myDataRow1 in myDataSet.Tables["points"].Rows)
{
myDataRow1["track_easting"] = "665544";
}
Here is your original example
foreach (DataRow myDataRow1 in myDataSet.Tables["points"].Rows)
{
myDataSet.Tables["points"].Rows[0]["track_easting"] = "665544";
}
The difference between the two is that I am using the row populated by the foreach statememnt, you are using foreach to iterate through the list, but then calling the update directly on the table.
The foreach command in this case will step through every row in the table returning a reference to the row as myDataRow1, which can be directly altered. The benefit is simply not having to work out how many objects are there etc as per a for loop.
look foreach up, it is useful and as per another previous post, easy to read. whats more it is type safe.
Hope it helps
|
|
|
|
|
How to Make rdlc report to Rum Time
I have some problems to make a rdlc report
Simply
i Want make a rdlc report thorw Coding;
Thanks
|
|
|
|
|
Could someone point me at the risks of embedding forms from one development invironment into other development environments? For example writing an application in python and embedding it into a windows application or vice versa and the two apps have to communicate with each other.
I have been tasked with writing a windows app with a composite Gui which will have a COM facade and then have it embedded into an Omnis Studio form. For those of you unfamiliar with Omnis Studio think of Visual Studio on acid.
What are the dangers of writing an application in C# then embedding it onto another development platforms form?
|
|
|
|