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

Reply via email to