0rph3n
16-03-2006, 11:57
Ciao a tutti,
non riesco a capire sia come creare lo schema di un Data Set (non via codice, bensì usando i metodi dei Connector/NET), sia come popolarlo.
Cercando un po' nella rete ho trovato qualche esempio, tra i quali questo (http://dev.mysql.com/doc/refman/5.0/en/connector-net-architecture-adapter.html) :
Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
Dim conn As New MySqlConnection(connection)
Dim adapter As New MySqlDataAdapter()
adapter.SelectCommand = new MySqlCommand(query, conn)
adapter.Fill(dataset)
Return dataset
End Function
nella stessa pagina dove c'è il codice d'esempio, è riportato che:
Fill: Adds or refreshes rows in the DataSet to match those in the data source using the DataSet name, and creates a DataTable named "Table".
FillSchema: Adds a DataTable named "Table" to the specified DataSet and configures the schema to match that in the data source based on the specified SchemaType.
GetFillParameters: Gets the parameters set by the user when executing an SQL SELECT statement.
Update: Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified DataSet.
quindi visto che FillSchema aggiunge una tabella alla volta, immagino che dovrò usarlo tante volte quante sono le tabelle che voglio aggiungere allo schema del Data Set.
Mentre per quanto riguarda Fill vale lo stesso discorso fatto sopra per FillSchema, però oltre che creare la tabella la popola, o no?
Oltre a questo, non riesco a capire come dev'essere strutturata la query!
Infatti:
The following example creates a MySqlCommand and a MySqlConnection. The MySqlConnection is opened and set as the Connection for the MySqlCommand. The example then calls ExecuteNonQuery, and closes the connection. To accomplish this, the ExecuteNonQuery is passed a connection string and a query string that is an SQL INSERT statement.
Un insert?!?!?! :mbe: :confused:
Proprio non riesco a capire!
Vi prego, :help: me, perchè mi sto :muro:!
'iao
non riesco a capire sia come creare lo schema di un Data Set (non via codice, bensì usando i metodi dei Connector/NET), sia come popolarlo.
Cercando un po' nella rete ho trovato qualche esempio, tra i quali questo (http://dev.mysql.com/doc/refman/5.0/en/connector-net-architecture-adapter.html) :
Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
Dim conn As New MySqlConnection(connection)
Dim adapter As New MySqlDataAdapter()
adapter.SelectCommand = new MySqlCommand(query, conn)
adapter.Fill(dataset)
Return dataset
End Function
nella stessa pagina dove c'è il codice d'esempio, è riportato che:
Fill: Adds or refreshes rows in the DataSet to match those in the data source using the DataSet name, and creates a DataTable named "Table".
FillSchema: Adds a DataTable named "Table" to the specified DataSet and configures the schema to match that in the data source based on the specified SchemaType.
GetFillParameters: Gets the parameters set by the user when executing an SQL SELECT statement.
Update: Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified DataSet.
quindi visto che FillSchema aggiunge una tabella alla volta, immagino che dovrò usarlo tante volte quante sono le tabelle che voglio aggiungere allo schema del Data Set.
Mentre per quanto riguarda Fill vale lo stesso discorso fatto sopra per FillSchema, però oltre che creare la tabella la popola, o no?
Oltre a questo, non riesco a capire come dev'essere strutturata la query!
Infatti:
The following example creates a MySqlCommand and a MySqlConnection. The MySqlConnection is opened and set as the Connection for the MySqlCommand. The example then calls ExecuteNonQuery, and closes the connection. To accomplish this, the ExecuteNonQuery is passed a connection string and a query string that is an SQL INSERT statement.
Un insert?!?!?! :mbe: :confused:
Proprio non riesco a capire!
Vi prego, :help: me, perchè mi sto :muro:!
'iao