vb+sql2000中系统登入界面代码问题

来源:百度知道 编辑:UC知道 时间:2024/05/05 06:29:15
我用窗体中的两个文本框text1,text2输入用户名和密码 数据库表名为用户登入,数据库名为生产排产单,用ADODC1字符串连的数据库。运行之后提示select附近有语法错误。下面就是我编写的程序段,各位大侠帮帮忙。看看有什么错误。谢谢大家了
Public userdwname As String
Public username As String
Public userright As String
Public conn As String

Private Sub Command1_Click()
Dim password As String
Dim respond As String
username = text1.Text
password = text2.Text
On Error GoTo err1
Adodc1.ConnectionString = conn
Adodc1.RecordSource = "select * from 用户登入 where 用户名=" & "'" & username & "'" & " and " & "密码=" & "'" & password & "'"
Adodc1.Refresh
If Adodc1.Recordset.AbsolutePosition = adPosUnknown Then
respond = MsgBox("用户名或密码错误,请重新输入!", vbOKOnly, "警告")
If respond <> vbOKOnly Then
text1.SetFocus
text1.Text = ""
text2.Text = ""
username = ""
password = ""

CPoint Dp_Star(50,50), Dp_End(400,200);
CString strl,str2;
int nMapmode;
pDC->SetWindowOrg(0,0);
pDC->SetViewportOrg(300,300);
nMapmode=pDC->SetMapMode(m_nMapMode);

pDC->MoveTo(Dp_Star);
pDC->LineTo(Dp_End); //默认模式下绘制直线
pDC->SetBkMode(TRANSPARENT);
strl.Format("Dp_Star(%d,%d)",Dp_Star.x,Dp_Star.y);
pDC->TextOut(Dp_Star.x,Dp_Star.y,strl);
//输出直线截止端点的名称和设备坐标
str2.Format("Dp_End(%d,%d)",Dp_End.x,Dp_End.y);
pDC->TextOut(Dp_End.x,Dp_End.y,str2);

pDC->DPtoLP(&Dp_Star);
pDC->DPtoLP(&Dp_End);

strl.Format("Lp_Star(%d,%d)",Dp_Star.x,Dp_Star.y);
pDC->TextOut(Dp_Star.x,Dp_Star.y,strl);
str2.Format("Lp_End(%d,%d)",Dp_End.x,Dp_End.y);
pDC->TextOut(Dp_End.x,Dp_End.y,str2);

pDC->MoveTo(Dp_Star); //使用逻辑坐标绘制直线
pDC->LineTo(Dp_End);
pDC->SetMapMode(nMapmode); //恢复原映