请问VC操作SQL Server中这样写SQL语句对吗?请大家帮忙! 5
CStrings[8];this->GetDlgItem(IDC_EDIT_UNUM)->GetWindowText(s[0]);this->GetDlgItem(IDC...
CString s[8];
this->GetDlgItem(IDC_EDIT_UNUM)->GetWindowText(s[0]);
this->GetDlgItem(IDC_EDIT_UNAME)->GetWindowText(s[1]);
this->GetDlgItem(IDC_EDIT_UREGDATE)->GetWindowText(s[7]);
this->GetDlgItem(IDC_COMBO_USEX)->GetWindowText(s[2]);
this->GetDlgItem(IDC_EDIT_UAGE)->GetWindowText(s[3]);
this->GetDlgItem(IDC_COMBO_UDEPARTMENT)->GetWindowText(s[4]);
this->GetDlgItem(IDC_COMBO_UPOST)->GetWindowText(s[5]);
this->GetDlgItem(IDC_EDIT_UPASSWORD)->GetWindowText(s[6]);
sSql.Format("insert into designer(帐号,模型设计者,性别,年龄,部门,职称,密码,注册日期) values('%s','%s','%s',%d,'%s','%s','%s','%s')",s[0],s[1],s[2],atoi(s[3]),s[4],s[5],s[6],s[7]);
}
这条insert语句对吗?实现不了,请高手指点存在哪里?
注:编译没有错,但实现不了。错误提示是:列名无效,未能准备语句 展开
this->GetDlgItem(IDC_EDIT_UNUM)->GetWindowText(s[0]);
this->GetDlgItem(IDC_EDIT_UNAME)->GetWindowText(s[1]);
this->GetDlgItem(IDC_EDIT_UREGDATE)->GetWindowText(s[7]);
this->GetDlgItem(IDC_COMBO_USEX)->GetWindowText(s[2]);
this->GetDlgItem(IDC_EDIT_UAGE)->GetWindowText(s[3]);
this->GetDlgItem(IDC_COMBO_UDEPARTMENT)->GetWindowText(s[4]);
this->GetDlgItem(IDC_COMBO_UPOST)->GetWindowText(s[5]);
this->GetDlgItem(IDC_EDIT_UPASSWORD)->GetWindowText(s[6]);
sSql.Format("insert into designer(帐号,模型设计者,性别,年龄,部门,职称,密码,注册日期) values('%s','%s','%s',%d,'%s','%s','%s','%s')",s[0],s[1],s[2],atoi(s[3]),s[4],s[5],s[6],s[7]);
}
这条insert语句对吗?实现不了,请高手指点存在哪里?
注:编译没有错,但实现不了。错误提示是:列名无效,未能准备语句 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询