Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
3文本框1数据查询mysql_Mysql_Vb.net_If Statement_Textbox_Runtime Error - Fatal编程技术网

3文本框1数据查询mysql

3文本框1数据查询mysql,mysql,vb.net,if-statement,textbox,runtime-error,Mysql,Vb.net,If Statement,Textbox,Runtime Error,嗨,我现在是编程新手,我选择了vb.net,我遇到了这个问题,我有3个文本框分配给我 “繁殖”“名称”“年龄”,我喜欢将2个数据放在“繁殖”“名称”“年龄”中,并且仍然被记录到mysql中,我的代码是 如果txtboxbreed1.txt,则 品种。插入品种(brd) Elseif txtboxbreed2.text然后 品种。插入品种(brd) Elseif txtboxbreed3.text然后 品种。插入品种(brd) 我得到的只是一个运行时变量brd在分配之前就已经使用了谢谢你的帮助和

嗨,我现在是编程新手,我选择了vb.net,我遇到了这个问题,我有3个文本框分配给我 “繁殖”“名称”“年龄”,我喜欢将2个数据放在“繁殖”“名称”“年龄”中,并且仍然被记录到mysql中,我的代码是

如果txtboxbreed1.txt,则
品种。插入品种(brd)
Elseif txtboxbreed2.text然后
品种。插入品种(brd)
Elseif txtboxbreed3.text然后
品种。插入品种(brd)
我得到的只是一个运行时变量brd在分配之前就已经使用了谢谢你的帮助和抱歉我用手机输入“name”和“age”仍然是一样的,但“age”是组合框

按钮添加功能

Dim doggo as new dogclass
Dim breed as new breedclass

Dim fname as string = txtboxfname.text
Dim lname as string = txtboxlname.text
Dim brd as string
Dim name as string
Dim age as string

IF txtboxbreed1.txt then
    Breed.insertbreed(brd)
Elseif txtboxbreed2.text then
    Breed.insertbreed(brd)
Elseif txtboxbreed3.text then
    Breed.insertbreed(brd)
End if

If txtboxname1.text And comboboxage1.text then
Doggo.insertdog(name,age)
Elseif txtboxname2.text and comboboxage2.text then Doggo.instertdog(name,age)
Elseif textboxname3.text and comboboxage2.text then doggo.insertdog(name,age)

If verif and person.insertowner(fname,lname) then
Msgbox("yes")
Else
Msgbox ("sorry")
End if
End sub

Function verif as boolean
If txtboxfname.text.trim = " " or (allofthe txtboxes and comboboxes ).text.trim =" "
Else 
Return true
End if
End function

`
CLASSES
`
public function insertowner(byval fname as string ,byval lname as string) as boolean

Using command as new mysqlcommand(" insert into table(fname,lname) values (@fn,@ln),db.Connection" 

Command.parameter.add("@fn",mysqldbtype.varchar).value = fname

Db.connection

If command.executenonquery =  1 then
Return true
Else 
Return false
End if
End using
dogclass(年龄、姓名)和breedclass(品种)是相同的格式,我被困在txtboxbreed1中,我应该在那里放什么才能像所有文本框一样记录下来


我从各种源代码中复制了一些代码谢谢你首先,由于各种原因,这些代码无法编译。如果您希望我们帮助您处理不起作用的代码,那么请向我们展示该代码,而不是它的模糊近似值。其次,您报告的错误消息准确地告诉您问题所在。如果没有实际设置
brd
变量,为什么要调用
Breed.insertbreed
并传递
brd
变量?如果你认为你已经设置了它,那么你是错的,所以你需要向我们展示其余的相关代码,这样我们才能指出你错的原因。我忘了将dim person添加为ownerclass