> but when I tried to put data in it, it does not work.

Could you better describe what you mean by "It doesn't work" ?
It would be interesting to know what error you get for example.


Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


----- Original Message ----- 
From: "Ramalingam, Saravanan (GE Infra, Energy)"
<[EMAIL PROTECTED]>
To: <delphi-talk@elists.org>
Sent: Thursday, October 12, 2006 10:37 AM
Subject: Using WinForm controls in VCL .NET applications


> I used "WinForm Control Import Wizard" to import winform's DataGrid
> component and it works fine, I can see the control and place it on a
> form,
> but when I tried to put data in it, it does not work.
>
> Code:
> ~~~~~
>
> unit Unit1;
>
> interface
>
> uses
>
> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
> Forms,
>
> Dialogs,System.Data.SqlClient,System.Data, System.ComponentModel,
>
> Borland.Vcl.StdCtrls, Borland.Vcl.NetControlContainer,
>
> Borland.Vcl.NetControl, Borland.Vcl.NetControlWrapper,
>
> Borland.Wrapper.System.Windows.Forms.DataGrid;
>
> type
>
> TForm1 = class(TForm)
>
> Button1: TButton;
>
> DataGrid1: TImpDataGrid;
>
> procedure Button1Click(Sender: TObject);
>
> private
>
> { Private declarations }
>
> public
>
> { Public declarations }
>
> Connection: SqlConnection;
>
> Adapter: SqlDataAdapter;
>
> CustomerDataSet: DataSet;
>
> end;
>
> var
>
> Form1: TForm1;
>
> implementation
>
> {$R *.nfm}
>
> procedure TForm1.Button1Click(Sender: TObject);
>
> begin
>
> Connection := SqlConnection.Create('Persist Security Info=False;' +
>
> 'Integrated Security=SSPI;database=TempCustomer;' +
>
> 'server=servername;Connect Timeout=30');
>
> Connection.Open;
>
> CustomerDataSet := DataSet.Create;
>
> Adapter := SqlDataAdapter.Create('select * from tblCustomer',
> Connection);
>
> Adapter.Fill(CustomerDataSet, 'Customer');
>
> DataGrid1.DataSource := CustomerDataSet;
>
> DataGrid1.DataMember := 'Customer';
>
> end;
>
> end.
>
> This code connects to the Database and get the data but it is not shown
> in
> the DataGrid control (TImpDataGrid).
>
> Thanks & Rgds,
> R.Saravanan
> __________________________________________________
> Delphi-Talk mailing list -> Delphi-Talk@elists.org
> http://www.elists.org/mailman/listinfo/delphi-talk

__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to