如何编写数据库配置文件的保存按钮 [英] How do I code the save button for a database profile

查看:89
本文介绍了如何编写数据库配置文件的保存按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法对我评论过的那些行上的保存按钮进行编码



我尝试了什么:



Private Sub savebtn_Click(sender As Object,e As EventArgs)处理savebtn.Click

rs.Fields(Student ID)。Value = txtid.Text

rs.Fields(Fullname)。Value = txtname.Text

rs.Fields(DOB)。Value = DTPicker1.Value

'如果radbtnm.Checked = True那么

''rs.Fields(性别)= radbtnm.Checked

'否则

'rs.Fields(Gender)= radbtnf.caption

''结束如果


rs.Fields(Dept)。值= combo1.Text

rs.Fields(Course)。Value = combo2.Text

rs.Fields(Semester)。Value = combo3.Text

rs.Fields(地址)。值= txtaddres.Text

rs.Fields(电话号码)。值= txtphone.Text

MsgBox(数据已保存成功!!!,vbInformation)

rs.Update()



End Sub

i am failing to code the save button on those lines that i commented

What I have tried:

Private Sub savebtn_Click(sender As Object, e As EventArgs) Handles savebtn.Click
rs.Fields("Student ID").Value = txtid.Text
rs.Fields("Fullname").Value = txtname.Text
rs.Fields("DOB").Value = DTPicker1.Value
' If radbtnm.Checked = True Then
'' rs.Fields("Gender") = radbtnm.Checked
'Else
' rs.Fields("Gender") = radbtnf.caption
'' End If

rs.Fields("Dept").Value = combo1.Text
rs.Fields("Course").Value = combo2.Text
rs.Fields("Semester").Value = combo3.Text
rs.Fields("Address").Value = txtaddres.Text
rs.Fields("Phone No").Value = txtphone.Text
MsgBox("Data is saved successfully!!!", vbInformation)
rs.Update()

End Sub

推荐答案

' If radbtnm.Checked = True Then
'' rs.Fields("Gender") = radbtnm.Checked
'Else
' rs.Fields("Gender") = radbtnf.caption
'' End If





在一种情况下,你要分配一个布尔(已检查);在另一方面,一个字符串(标题);到另一个(明显的)字符串(性别)。



我希望有另一个字幕,不变;或者拼写问题。



在任何情况下,你都不能(通常)为给定的记录集字段分配2种不同的类型。



In one case, you're assigning a "bool" (checked); in the other, a "string" (caption); TO another (apparent) string ("Gender").

I expect there's "another" caption, constant; or a spelling issue.

In any case, you can't (usually) assign 2 different types to a given "record set field".


这篇关于如何编写数据库配置文件的保存按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆