怎样用ADOX创建数据库,数据表和索引? 怎样用ADOX创建数据库,数据表和索引?有没有其它简单的方法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 creat table 不就是SQL语句吗建议看SQL Server帮助 function TForm3.GetType: String;//此函数用的是SQL Server数据库begin case ComboBox1.ItemIndex of 0: Result := 'varchar'; 1: Result := 'numeric'; 2: Result := 'datetime'; 3: Result := 'ntext'; end;end;function TForm3.GetQuerStr: String; // 此函数用的是ACCESS数据库begin case ComboBox1.ItemIndex of 0: Result := 'Alter table diary add ' + Edit1.Text + ' varchar(' + Edit3.Text + ')' + 'null'; 1: Result := 'alter table diary add ' + Edit1.Text + ' float ' + ' null'; 2: Result := 'alter table diary add ' + Edit1.Text + ' datetime' + 'null'; 3: Result := 'alter table diary add ' + Edit1.Text + ' text ' + 'null'; end; //删除字段的话得先把字段取出 然后用 alter table diary drop column 字段名end;procedure TForm3.Button1Click(Sender: TObject);var QuerStr: String;begin QuerStr := GetQuerStr; with ADOQuery1 do begin Close; SQL.Clear; SQL.Add(QuerStr); try ExecSQL; except ShowMessage('创建字段出错,请重新创建'); Exit; end; 编写组件遇到个问题,,麻烦各位解答 版聚,上海 Socket客户端如何实现多个连接以提高通讯速度?(急) 获取字段的表名 请问grid里怎么操作dbf或是mdb,还有小弟是初学,有什么进步快的方法。 请问这个问题如何解决? 100分的难题!!!!,已经多日还没有解决 关于把delphi5的程序升级到delphi7的问题? 下载书藉地址 关于金额录入的问题 dbexpress连接MSSqlserver2000出错 使用dbexpress更新了多表数据,用ApplyUpdates方法时候总是出错,怎么解决?帮UP.
不就是SQL语句吗
建议看SQL Server帮助
begin
case ComboBox1.ItemIndex of
0: Result := 'varchar';
1: Result := 'numeric';
2: Result := 'datetime';
3: Result := 'ntext';
end;
end;function TForm3.GetQuerStr: String; // 此函数用的是ACCESS数据库
begin
case ComboBox1.ItemIndex of
0: Result := 'Alter table diary add ' + Edit1.Text + ' varchar(' + Edit3.Text + ')' + 'null';
1: Result := 'alter table diary add ' + Edit1.Text + ' float ' + ' null';
2: Result := 'alter table diary add ' + Edit1.Text + ' datetime' + 'null';
3: Result := 'alter table diary add ' + Edit1.Text + ' text ' + 'null';
end;
//删除字段的话得先把字段取出 然后用 alter table diary drop column 字段名
end;
procedure TForm3.Button1Click(Sender: TObject);
var
QuerStr: String;
begin
QuerStr := GetQuerStr;
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add(QuerStr);
try
ExecSQL;
except
ShowMessage('创建字段出错,请重新创建');
Exit;
end;