Does anybody know how could I use the SqlceResultSet GetValues method
I use the following pice of code and the compiler give me and InvalidCastException
Public
Class Form1 Public conexion As Data.SqlServerCe.SqlCeConnection = New Data.SqlServerCe.SqlCeConnection("Data Source=GestionAlmacen.sdf") Public ComandoCarga As Data.SqlServerCe.SqlCeCommand = conexion.CreateCommand Public ResultSet As Data.SqlServerCe.SqlCeResultSet Public tabla As Data.DataTable Private view As Data.SqlServerCe.ResultSetView = Nothing Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Loadconexion.Open()
ComandoCarga.CommandText =
"SELECT * from [Movimientos Cabecera]"ComandoCarga.CommandType = Data.CommandType.TableDirect
ComandoCarga.IndexName = "PK_Movimientos Cabecera"ComandoCarga.CommandText =
"Movimientos Cabecera"ResultSet = ComandoCarga.ExecuteResultSet(Data.SqlServerCe.ResultSetOptions.Scrollable
Or Data.SqlServerCe.ResultSetOptions.Updatable)ResultSet.ReadFirst()
Dim fila As New Object()ResultSet.GetValues(fila)
Me.DataGrid1.DataSource = tabla End SubEnd
Class
Thanks for your help

ResultSet GetValues
HockeyNut
still it is not really clear what you are doing wrong.
Can you email me a small sample of your application that reproduces the problem.
You can email it to mark dot ihimoyan at microsoft dot com.
Pascal Geuze
I obtain this exception
System.InvalidCastException was unhandled
Message="InvalidCastException"
StackTrace:
en DeviceApplication1.Form1.Form1_Load()
en System.Windows.Forms.Form.OnLoad()
en System.Windows.Forms.Form._SetVisibleNotify()
en System.Windows.Forms.Control.set_Visible()
en System.Windows.Forms.Application.Run()
en DeviceApplication1.Form1.Main()
I think that the problem is that I have to determine the proportions of the array of object before I use the instruction getvalues of the ResultSet,isn’t it
Thanks again for your help Mark
Nuwc
Can you please post the details of the exception you are getting.
This will be helpful in figuring out what the problem may be.
So far what you have posted here looks ok.
Thanks.