|
Hi,
there's a method called SqlDataAdapter.Update(DataSet myDS). This method should solve your problem.
Tobias
|
|
|
|
|
i writr following code
Hi there,
I have two databases, MS Access and SQL Server 2000
Using a procedure in Visual Studio i would like to copy all the records from one table in MS Access into an existing table in SQL Server (the tables have the same name and the same layout)
I tried to prepare one Dataset to copy from Access into SQL Server but when i run the command 'DaSQL.Update(DsSQL, "Tabella") nothing happens (not even an exeption has been raised), looking during debug, the DataSet seems filled though...
Please could anyone explain what's wrong and / or is there a more quicker way to copy data from a table to another?
Note i woul have as a final goal to get data from an AS400 database by ODBC, manage it, and put it on SQL Server for a 'data mining' scope (eliminating the use of MS Access, not suited for FE-BE).
the procedure goes like this;
' Create a connection to the MS Access Database
Dim connectionToAccess As New OleDbConnection(DBConnectionAccString)
strsql = "SELECT * FROM [TABELLA]"
connectionToAccess.Open()
Dim DaAccess As New OleDbDataAdapter(strsql, connectionToAccess)
Dim DsAccess As New DataSet("ACCESS")
DaAccess.FillSchema(DsAccess, SchemaType.Source, "Tabella")
DaAccess.Fill(DsAccess, "Tabella")
' Create a connection to the SQL Database
Dim connectionToSQL As New SqlConnection(DBConnectionSQLString)
connectionToSQL.Open()
Dim DaSQL As New SqlDataAdapter(strsql, connectionToSQL)
Dim DsSQL As New DataSet("SQL")
DaSQL.FillSchema(DsSQL, SchemaType.Source, "Tabella")
DaSQL.Fill(DsAccess, "Tabella")
DaSQL.Update(DsSQL, "Tabella")
Note I tried also the following, withou a result;
DsSQL = DsAccess.Copy
DaSQL.Update(DsSQL, "Tabella")
Please is there someone who could respond !!???
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
hi I believe u r using C# for all this. now in .NET 2005, u have different namespaces for different types of the DBs for eg. OleDB for Access and SqlClient for SQL server 2000/05, but the good news is that one thing remains common in the both and that is Dataset.
So now from ur question, I infer that u want to transfer ur data from Access to SQL server, if thats right, then the one way is to , first populate the dataset1 with data from Access for different tables, follow the same approach. Now u can put this data in a datagrid and then finally use properties and constructors u insert all the grid rows one by one using a for loop into ur SQL server DB.
Other approach is to use SQL servr Integration Services (SSIS) directly to transfer data from any data source to any destination.
|
|
|
|
|
Hi All,
I am writing a project in C# using a web browser control. Objective of this project is to automate the browser. I have an element that I want to be clicked automatically. I am using mshtml.IHTMLDocument3 interface to access DOM document and then find the element by ID. Once I do find the element by ID, I cast it to mshtml.IHTMLElement; but when I do that, I get null reference to mshtml.IHTMLElement variable. Therefore, my click method does not work. Please Help. I need this for my job.
mshtml.IHTMLDocument3 doc = (mshtml.IHTMLDocument3)this.LPBrowser.Document.DomDocument;
doc.getElementById("newlink");
mshtml.IHTMLElement a;
a = (mshtml.IHTMLElement)doc; //Casting here but a becomes null
a.click(); //null.click() so this doesn't work
Thanks.
Abdul Asif.
|
|
|
|
|
The getElementById method returns a reference, it doesn't convert the doc variable into an element reference.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hi all guys,
I am building one eFlowchart whose work is similar to normal paper flowchart.There are lots of picturebox ctrl on eFlowchart.I hav to allow author to connect all picturebox with its connector.
But main problem is how to move picturebox smoothly with mouse cursor.I am using mouse_down and mouse_move event.
I have taken click coordinates in mouse_down event with e.x and e.y and then making plus-minus in mouse_move event, but still I am getting slight a bit roughness in ctrl movements.ctrl in design time in visual studios are very smooth,I wanna that type of smoothness.
Pls help
Thank you guys.
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
|
Hi abhijit
Ya, you are correct tht I had already posted the question and also got the solution frm u,but all this I had programmed for child picture boxes on form control, but now as my requirement got change, I have to move every child picturebox on picture box ctrl ( instead of form control ).
When i move the child picturebox on picture control from xy1 location to xy2 location then picture looks like blur ( it seems that its own ghost is following at each mouse_move event).I am not getting the smotheness in dragging.
pls reply
thx
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
I want to wrap an object and add properties to that object's properties.
IE, I currently consume an object called Song. Song has a property called Artist.
I happen to know that the Artist can only be 256 chars long. But I want my code to be able to refer to that value programmatically, like this:
Song myTune = GetSong("Hello Dolly");
int x = myTune.Artist.MaxLength;
How can I do this? How do I "add" a property to the existing property of an object? Is that allowed syntactically?
|
|
|
|
|
That was not asked well.
I want to create my own class that wraps Song. So, I'll actually end up with something like:
// get the Song
Song aTune = GetSong("Hello Dolly");
// wrap that Song in my own object
mySongObject mySong = new mySongObject(aTune);
// Get the Artist of the Song
string artist = mySong.Artist;
// Get the maximum length of the Artist property
int x = mySong.Artist.MaxLength;
The above example assumes that my class is a base class that takes a Song as it's argument. However, I could instead derive my class from Song, and use a cast. Which of these approaches is best here?
Then, once that's settled - can both mySong.Artist and mySong.Artist.MaxLength yield values? If so, how do I implement this?
|
|
|
|
|
JoeRip wrote: I could instead derive my class from Song, and use a cast.
No, you couldn't. That would enable you to cast your object to Song, but not the other way.
JoeRip wrote: can both mySong.Artist and mySong.Artist.MaxLength yield values? If so, how do I implement this?
You can create a class for the Artist property, that has properties and an implicit conversion to string. That way you can both get the artist as a string and get properties from it:
public class LimitedString {
private string _value;
private int _maxLength;
publlic LimitedString(string value, int maxLength) {
_value = value;
_maxLength = maxLength;
}
public string Value { get{ return _value; } }
public int MaxLength { get { return _maxLength; } }
public static implicit operator string(LimitedString limited) {
return limited.Value;
}
}
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
JoeRip wrote: How do I "add" a property to the existing property of an object? Is that allowed syntactically?
Yes it is allowed.
JoeRip wrote: int x = myTune.Artist.MaxLength;
In song class Artist should be a property for a class which contains MaxLength property. See the below example
public class Song
{
public SongArtist Artist
{
get{}
set{}
}
public static void Main()
{
Song mySong = new Song();
int x = mySong.Artist.MaxLength;
}
}
public class SongArtist
{
public int MaxLength
{
get {}
set {}
}
}
|
|
|
|
|
I'm not quite following. What is happening in the Main() method of this class?
|
|
|
|
|
Creating object for Song class. In your example you are getting the object from GetSong() method. You can change that in your way
|
|
|
|
|
hi,
while using inheritance if we have two classess ie animal and bird -when do we craete a new object this way in main function
animal obj = new bird();
and when are the instances that we create an object to call a method::
i know that we do so wen we have to call a method from another class and to call a nonstatic function into a static function again we create an object.
otherthan these what are the other instances we do so ......
thanks
C#
|
|
|
|
|
1st learn to write proper question, then expect to get proper answer.
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
what are the times that we create an object to call a method::
i know that we do so wen we have to 1) call a method from another class and
2)to call a nonstatic function into a static function again we create an object.
otherthan these what are the other instances we do so ......
thanks
C#
|
|
|
|
|
how to get the innerHtml from iframe in C# ?
thanks ~
|
|
|
|
|
First you have to get document object for the IFRAME. Then Use innerHTML property to get it. See the following eg:
var TxtEditor = document.getElementById('IFrameId').contentWindow.document;
alert(TxtEditor.body.innerHTML)
|
|
|
|
|
to [N a v a n e e t h]:
thank you reply,but how did it in c# ?
|
|
|
|
|
Make a hidden textbox run at server. Get IFRAME value using javascript, and assign to this textbox. Since your hidden textbox is a server control, you have access to it from code behind.
|
|
|
|
|
//Make a hidden textbox run at server. Get IFRAME value using javascript, and assign to this textbox.
very good ~
but ,it also have problems ~
I have got the method that get value of iframe and assigned it to TextBox,
but when run the method to do this ? it required a Event,a suitable Event,the Iframe haven't got those Events,for example:onkeyup,onkeydwon,onchange,onpropertychange...,and in this section it haven't got a or the other control like to occur.
In other way , there's a user control with two properties:Text and Content.
when using the user control ,we just see the Content property is ok ,
the Content property's value is the iframe's innerHtml,Now i know how to get innerHtml in javascript ,but i don't know how to use it in codebehind ?!
the former said "..and assign to this textbox...",It request a suitable Event to do that , for there's no Form label,No button , only a button is in another page that use the user control,when it clicked we must show the user control's property ~ how ever , I do not like this method...
thank you very much !
|
|
|
|
|
Your question isn't clear enough!
Are you hosting a web control in a WinForm application written in C#?
Are you hosting a web control in a WPF application written in C#?
Are you using C# as a client side scripting language in the browser?
Are you writing an ASP.NET page in C# and want to see what the client has in the IFrame (nope, not possible, but it might still be what you are looking for so I included it)?
Are you accessing a web server from C# and want to extract the HTML from the web server response?
I am sure there are more possibilities, but this is what I could come up with as I typed, so you probably need to add some details on what you are doing and what you try to achieve.
|
|
|
|
|
in one word ,
In a UserControl ,How to get a iframe's innerHtml value and assign to its property ?
|
|
|
|
|
I used this code for connect to the database:
conStr = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\DB\\DBPerson.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
conn = new SqlConnection(conStr);
conn.Open();
How to move connection string to ApplicationConfig file? And how to use in my source code?
Best Regards...
|
|
|
|