写好SQL语句之后,在C#中建立连接执行
解决方案 »
- 一个比较难的算法,求大神演绎,最好是C++或者C#语言。
- 新手求教
- VS2005开发Office
- 关于视图问题!!!
- 加载DLL 问题
- 怎样设置登录界面不会连续出现提示信息啊?
- 不怕兄弟们笑话,用了很长时间的.net,却还真没有太多体验到xml能具体地在我们的编程中做什么,讨教了!!!!!!!!!!!!!!!!!!!!!!!
- 请问,关于List<Model>作为DataGridView的数据源进行绑定后,DataGridView进行增、删、改后如何更新数据库
- 求C#开发C/S模式教程或实例
- c#的程序为何不能加壳?
- 无法打开登录 'employee' 中请求的数据库
- 判断数据库里是否存在数据的问题
{
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
OleDbCommand myCommand = new OleDbCommand(myExecuteQuery, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
}
不一致的话需要人为对齐。比如:table1 id sname
table2 id fullname passwordselect id,fullname as sname into table1 from table2 where ...
create proc [dbo].[Copytable](@OldTable varchar(20))
as
create table #temp(ID int)
declare @ExecSql varchar(1000)
select @ExecSql=''
declare @name varchar(20)
declare @type int
declare @length char(2)
declare @TypeName varchar(20)
declare tablename cursor for select name,xtype,length from syscolumns where id in( select id from sysobjects where name='t_ortherbadysdjb' and xtype='u' )and Name !='id'
open tablename
fetch next from tablename into @name,@type,@length
while @@fetch_status=0
begin
select @TypeName=name from systypes where xtype=@type
--int类型与字符类型的写法不统一
if @TypeName='int'
begin
select @ExecSql=' alter table #temp add '+@name+' '+@TypeName
exec(@ExecSql)
end
else
begin
select @ExecSql=' alter table #temp add '+@name+' '+@TypeName+'('+@length+')'
exec(@ExecSql)
end
fetch next from tablename into @name,@type,@length
end
close tablename
deallocate tablename
select * from #temp
drop table #temp