发博文
个人资料
笨蛋
笨蛋
  • 博客等级:
  • 博客积分:176
  • 博客访问:37,247
  • 关注人气:4
评论
加载中…
留言
加载中…
友情链接
音乐播放器
图片播放器
访客
加载中…
好友
加载中…
博文
标签:

it

分类: asp.net
首先,我在工程项目里建立以下几个文件夹:
 
然后看代码实现
1.创建数据库
create database article
CREATE TABLE [news] (
 [id] [int] IDENTITY (1, 1) NOT NULL ,
 [title] [char] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [content] [varchar] (8000) COLLATE Chinese_PRC_CI_AS NULL ,
 [FilePath] [char] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
2.web.config配置数据库连接文件关键代码
<appSettings>
    <add key='connectionstring' value='server=.;uid=sa;pwd=;database=article'/>
  </appSettings>
连接数据库类
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm
阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

Procedure TForm1.Button1Click(Sender: TObject);
Var
  FormHwd, OKHandle, EDHwd1, EDHwd2: THandle;
Begin
  FormHwd := FindWindow(nil, '用户登录'); //窗口名称
  If FormHwd > 0 Then
  Begin
    OKHandle := FindWindowEx(FormHwd, 0, PChar('TBitBtn'), Pchar('确定'));//按钮
    EDHwd1 := FindWindowEx(FormHwd, 0, PChar('TEdit'), nil);
    SendMessage(EDHwd1, WM_SETTEXT, 255, Longint(PChar('0')));
    EDHwd2 := FindWindowEx(FormHwd, EDHwd1, PChar('TEdit'), nil);
    SendMessage(EDHwd2, WM_SETTEXT, 255, Longint(PChar('jwc01')));
    SendMessage(OKHandle,BM_CLICK,0,0);
  End;
End;
阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

分类: Delphi相关
delphi dbgrid 导出Excel表  

/////////  利用剪贴板,速度很快!适合装有Excel的机器/////////////////////  
 
  USES  Clipbrd,ComObj;  
   
  procedure  TForm1.Button1Click(Sender:  TObject);  
  var  
      str:string;  
      i:Integer;  
      excelapp,sheet:Variant;  
  begin  
  //    lbl2.Caption:=DateTimeToStr(Now);  
      str:='';  
      dbgrd1.DataSource.DataSet.DisableControls;  
      for  i:=0  to  dbgrd1.DataSource.DataSet.FieldCount-1  do  
        str:=str+dbgrd1.DataSource.DataSet.fields[i].DisplayLabel+char(9);  
      str:=str+#13;  
      dbgrd1.DataSource.DataSe
阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

分类: asp.net

string strOrderID = this.textBox1.Text.Trim().ToString();   
string strCustomerID = this.textBox2.Text.Trim().ToString();  
           //被SQL注入的拼SQL的句子是这么写的  
           //string strSql = 'Select * from [Orders] Where OrderId = '' + strOrderID + '' AND CustomerID = '' + strCustomerID + ''';  
           //防止SQL注入的拼SQL的句子是这么写的  
           string strSql = 'Select * from [Orders] Where OrderId = @strOrderID  AND CustomerID = @strCustomerID';  
           //加sqlParameter变量  
           SqlCommand myCommand = new SqlCommand(strSql, con);&nbs

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

分类: asp.net

一,验证方法

 /// <summary>
  ///SQL注入过滤
  /// </summary>
  /// <param name='InText'>要过滤的字符串</param>
  /// <returns>如果参数存在不安全字符,则返回true</returns>
  public static bool SqlFilter2(string InText)
  {
   string word='and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join';
   if(InText==null)
    return false;
   foreach(string i in word.Split('|'))
   {
    if((InText.ToLower().IndexOf(i+' ')>-1)||(InText.ToLower().IndexOf(' '+i)>-1))
    {
     return true;
    }
   }
   return false;
  }

二,Global.asax 事件

  /// <summary>
  /// 当有数据时交时,触发事件

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

分类: Delphi相关

QRBand 上放置N个QRLabel 不设置分栏.

 

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  QuickRep1.Preview;
end;

procedure TForm1.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
var
 i:integer;
begin
  MoreData   :=   True;

  if   adoquery1.Eof  then MoreData   :=   False;


  QRLabel1.Caption:='';
  QRLabel2.Caption:='';
  QRLabel3.Caption:='';
  QRLabel4.Caption:='';
  QRLabel5.Caption:='';
  QRShape2.Pen.Color:=clwhite;

  for   I:=    to    do
  begin

    if adoquery1.Eof then break;

    case i of
      1:  QRLabel1.Caption:=   adoquery1.FieldByName('OA_LoginID').AsString;

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

分类: Delphi相关

创建子窗口(MDI)

Procedure Tmain_form.OpenForm(FormClass: TFormClass; Var fm;

  AOwner: TComponent);

Var

  i: integer;

  Child: TForm;

Begin

  For i := 0 To Screen.FormCount - 1 Do

    If Screen.Forms[i].ClassType = FormClass Then

    Begin

      Child := Screen.Forms[i];

      If Child.WindowState = wsMinimized Then

        ShowWindow(Child.Handle, SW_SHOWNORMAL)

      Else

        ShowWindow(Child.Handle, SW_SHOWNA);

      If (Not Child.Visible) Then Child.Visible := true;

      Child.BringToFront;

      Child.Setfocus;

      TForm(fm) := Child;

&nbs

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
(2009-09-21 13:56)
标签:

it

分类: Delphi相关

在SERVER面板上选择WordDocument 和WordApplication 组件

 

Procedure Tform1.ConnectWord;

Begin

  Try

    WordApplication.Connect;

  Except

    MessageDlg('Word可能没有安装!', mtError, [mbOk], 0);

    Abort;

  End;

 

  Try

    WordApplication.Visible := True;

    WordApplication.caption := 'Delphi automation';

  Except

    Try

      quitword;

      WordApplication.Connect;

      WordApplication.Visible := True;

      WordApplication.caption := 'Delphi automation';

    Except

      Abort;

    End;

  End;

End;

 

Procedu

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
(2009-07-01 17:18)
标签:

it

分类: asp.net

<table cellspacing='1' cellpadding='1' width='712' border='0' align='center'>

</table>

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
标签:

it

分类: asp.net

<marquee style='WIDTH: 220px; HEIGHT: 250px' direction='up' scrolldelay='200' onmouseover='this.stop()'onmouseout='this.start()'>
                                <asp:GridView id='GVItemOne' runat='server' Width='223px' Font-Size='9pt' Height='39px' ForeColor='RoyalBlue' CellPadding='4' DataKeyNames='ID' GridLines='None' PageSize='15'>
                                <FooterStyle BackColor='#507CD1' ForeColor='White' Font-Bold='True'></FooterStyle>
                                &l

阅读  ┆ 评论  ┆ 转载 ┆ 收藏 
  

新浪BLOG意见反馈留言板 不良信息反馈 电话:4006900000 提示音后按1键(按当地市话标准计费) 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

新浪公司 版权所有