SQL2005中文乱码解决方案

使用SQL SERVER2005的时候常常遇到中文字符为乱码的情况,经过研究发现,设置SQL的排序规则可以解决这个问题。

1、登录服务器打开Microsoft SQL Server Management Studio。

2、在要修改的数据库上单击鼠标右键,并选择“属性”。

3、在弹出的数据库属性窗口中点击“选择页”中的“选项”。

4、将排序规则由默认的SQL_Latin1_General_CP1_CI_AS修改为Chinese_PRC_CI_AS。

5、点击确定就OK。

varchar修改为nvarchar
char修改为nchar

注:如果无法修改的话,请尝试关闭所有与此数据库的连接,实在不行的话请重启动SQL SERVER服务。

EXCEL 自定义菜单

Sub XXXscrap()

Dim XXX As CommandBarPopup
Dim scrap As CommandBarPopup
Dim about As CommandBarControl

Dim finderror As CommandBarControl
Dim cleanup As CommandBarControl
Dim updatascrap As CommandBarControl

‘菜单栏出现公司名称
Set XXX = Application.CommandBars("Worksheet Menu Bar").Controls.Add(Type:=msoControlPopup)
XXX.Caption = "XXX公司"

‘点击XXX公司,出现两个子项
Set scrap = XXX.CommandBar.Controls.Add(Type:=msoControlPopup)
scrap.Caption = "Scrap"

Set about = XXX.CommandBar.Controls.Add(Type:=msoControlButton, ID:=2950)
about.Caption = "About"
about.OnAction = "abouttony"

‘点击scrap,出现三个子项
Set cleanup = scrap.CommandBar.Controls.Add(Type:=msoControlButton)
cleanup.Caption = "Clean up data"
cleanup.OnAction = "cleanuptony"

Set finderror = scrap.CommandBar.Controls.Add(Type:=msoControlButton)
finderror.Caption = "Find error data"
finderror.OnAction = "finderrortony"

Set updatascrap = scrap.CommandBar.Controls.Add(Type:=msoControlButton)
updatascrap.Caption = "Updata Scrap"
updatascrap.OnAction = "updatascraptony"

End Sub

bat 备份文件,上传文件

文件1:

ftp  -n  -s:"upload.txt"
call upload_bankup_rename.bat

文件2:upload.txt

Open 192.168.1.1
User username password
Cd /as3t/exp_imp/C162/scrap
Bin
Prompt
mput E:escraptesttransfer.csv
mput E:escraptestadjust.csv
bye

文件3:upload_bankup_rename.bat

rem 获取当前日期和时间
set bak_date=%date:~0,4%%date:~5,2%%date:~8,2%
set bak_time=%time:~0,8%
set bak_time=%bak_time::=%
cd E:escraptest
rem 重命名备份至另外的文件夹
IF EXIST transfer.csv Ren transfer.csv  %bak_date%_%bak_time%_transfer_local.csv
xcopy %bak_date%_%bak_time%_transfer_local.csv E:escrapbatbankup_
del %bak_date%_%bak_time%_transfer_local.csv
IF EXIST adjust.csv Ren adjust.csv  %bak_date%_%bak_time%_adjust_local.csv
xcopy %bak_date%_%bak_time%_adjust_local.csv E:escrapbatbankup_
del %bak_date%_%bak_time%_adjust_local.csv

怎样把数据库中一个字段的内容存入数组里

首先筛选出数据库中content字段的纪录个数count
定义一个数组,存放内容:
String content[]=new content[count];
//筛选值,并将其存放在数组中
 sql="select * from 表名";
 db.execQuery(Util.gb2iso(sql));
 int n = 0;
while (db.rs.next())
{
content[n]=db.rs.getstring(“content”);
n++;
}
 db.clear();