真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

sqlserver寫程序,sqlserver寫sql語句

C#如何編寫一段程序,能控制SqlServer數(shù)據(jù)庫服務(wù)重啟?

public string RunDosCommand(string command)

成都創(chuàng)新互聯(lián)是一家網(wǎng)站設(shè)計公司,集創(chuàng)意、互聯(lián)網(wǎng)應(yīng)用、軟件技術(shù)為一體的創(chuàng)意網(wǎng)站建設(shè)服務(wù)商,主營產(chǎn)品:成都響應(yīng)式網(wǎng)站建設(shè)公司、成都品牌網(wǎng)站建設(shè)營銷型網(wǎng)站建設(shè)。我們專注企業(yè)品牌在網(wǎng)站中的整體樹立,網(wǎng)絡(luò)互動的體驗,以及在手機(jī)等移動端的優(yōu)質(zhì)呈現(xiàn)。成都網(wǎng)站建設(shè)、網(wǎng)站制作、移動互聯(lián)產(chǎn)品、網(wǎng)絡(luò)運營、VI設(shè)計、云產(chǎn)品.運維為核心業(yè)務(wù)。為用戶提供一站式解決方案,我們深知市場的競爭激烈,認(rèn)真對待每位客戶,為客戶提供賞析悅目的作品,網(wǎng)站的價值服務(wù)。

{

Process process = new Process();

process.StartInfo.FileName = "cmd.exe";

process.StartInfo.UseShellExecute = false;

process.StartInfo.RedirectStandardInput = true;

process.StartInfo.RedirectStandardOutput = true;

process.StartInfo.RedirectStandardError = true;

process.StartInfo.CreateNoWindow = true;

process.Start();

process.StandardInput.WriteLine(command);

process.StandardInput.WriteLine("exit");

return process.StandardOutput.ReadToEnd();

}

command 參數(shù)可以輸入如

net start mssqlserver

net stop mssqlserver

編寫一個SQLSERVER 存儲過程

代碼是最好的文字,不多說,請看我的代碼,并給分,呵呵。

--step1. 建表

if exists(select * from sysobjects where id=object_id('student') and objectproperty(id,'IsTable')=1)

drop table student

go

create table student

(

id int identity(100,10) not null

,sname varchar(10) not null

,sno varchar(30) not null

)

go

--step2.建存儲過程

if exists(select * from sysobjects where id=object_id('proc_demo') and objectproperty(id,'IsProcedure')=1)

drop procedure proc_demo

go

create procedure proc_demo

@o_maxid int output

as

set nocount on

--如果希望大小寫敏感,使用第一句,因為SQL Server默認(rèn)是大小寫不敏感的

--update student set sno='cay_'+sno where ascii(substring(sname,1,1))=87 and ascii(substring(sname,2,1))=65 and sno not like 'cay_%'

update student set sno='cay_'+sno where sname like 'WA%' and sno not like 'cay_%'

print convert(varchar(10),@@rowcount)+'條記錄符合條件并被處理'

select @o_maxid=max(id) from student where id=100

if(@o_maxid is null) print '沒有找到符合條件的最大記錄'

set nocount off

go

--測試數(shù)據(jù)1

truncate table student

set identity_insert student on

insert into student(id,sname,sno)values(1,'WA1','1');

insert into student(id,sname,sno)values(2,'wa2','2');

insert into student(id,sname,sno)values(3,'3','3');

set identity_insert student off

go

--測試數(shù)據(jù)2

truncate table student

insert into student(sname,sno)values('WA1','1');

insert into student(sname,sno)values('wa2','2');

insert into student(sname,sno)values('3','3');

go

--測試過程

declare @maxid int

exec proc_demo @maxid out

print '最大id是'+convert(varchar(10),@maxid)

go

幫我寫個分頁的程序?(c# Sqlserver)

%@ Import Namespace="System.Data"%

br%@ Import Namespace="System.Data.SqlClient" %

brscript language="C#" runat="server"

brvoid Page_load()

br{

brif (!IsPostBack)

br{

brstring strConnection = "server=127.0.0.1;";

brstrConnection += "database=ztx;uid=sa;password=wxj;";

brSqlConnection sqlConnection1 = new SqlConnection(strConnection);

brstring strSql = "select top 20 i_id,i_caption,i_count,substring(i_content,1,20) as i_content from content";

brSqlDataAdapter sqlAdapter = new SqlDataAdapter(strSql, sqlConnection1);

brDataSet objDataSet = new DataSet();

brsqlAdapter.Fill(objDataSet);

brViewState["objDataSet"]=objDataSet

brbind();

br}

br}

br

brprotected void abc(object source, DataGridPageChangedEventArgs e)

br{

br

brzhangtianxing.CurrentPageIndex = e.NewPageIndex;

brbind();

br}

br

br protected void button1(object sender, EventArgs e)

br {

br zhangtianxing.CurrentPageIndex += 1;

br bind();

br }

br private void bind()

br {

br DataSet objDataSet = (DataSet)ViewState["objDataSet"];

br zhangtianxing.DataSource = objDataSet;

br zhangtianxing.DataBind();

br }

br/script

brhtml

brhead

brtitle中國新聞搜索中心/title

br/head

brbody

br

brform id="Form1" runat="server"

brtabletrtdasp:datagrid ID="zhangtianxing" runat="server" AllowPaging="True" PageSize="3" / /td/trTrtd

brasp:LinkButton OnClick="button1" ID="LinkButton1" runat="server"LinkButton/asp:LinkButton /td/tr/table

br/form

br/body

br/html

用 delphi寫個程序把SQLserver一個表中的數(shù)據(jù)逐行寫入txt文件

方法比較多,就說兩種先

var i,j:Integer;

s:string;

myfile:textfile;

begin

with query1 do

begin

close;

sql.clear;

sql.add('select * from sb_fcs');

open;

end;

AssignFile(myfile,'d:\2.txt');

Rewrite(myfile);

try

for i:=0 to query1.recordcount-1 do

begin

for j:=0 to query1.FieldCount-1 do

BEGIN

s:=query1.fields[j].name+':'+query1.fields[i].asstring+',';

writeln(myfile,s);//myfile 為要寫的txt文件

end;

query1.next;

end;

finally CloseFile(myfile);

END;

end;

方法二:

s1:string;

s:tstringlist;

with query1 do

begin

s1:='';

for i:=0 to fieldcount-1 do s1:=s1+fields[i].asstring+' ';

s.add(s1);

循環(huán)讀入

next;

end;

s.savetofile('c:\a.txt');


分享名稱:sqlserver寫程序,sqlserver寫sql語句
文章網(wǎng)址:http://weahome.cn/article/hdijch.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部