Home > Mobile >  The great god, please take a look at what's the problem?
The great god, please take a look at what's the problem?

Time:12-25

Great god please help to look at, when inserting data remotely, insert failure, but when I change the content of being inserted to specific content, can insert the data normally, this is what reason, is the assignment that places the type of data, or have other problems? Please look hard, be obliged,


 
Private fun zhusuInBound () {
Val produName=spiner11. Text
Val weight=produWeightBt. Text. The toString ()
Val colorName=spiner2. Text
Val amount=editProduAmount. Text. The toString ()
Val date1=the Date (). GetNowDate ()
Val menu=editProduMenu. Text
Val user1=getUser ()
Try {
Thread {
Val conn=DBUtil (.) conection ()
If (weight, length & gt; 0 {
If (amount. Length & gt; 0 {
If (menu. Length & gt; 0 {
Val SQL="insert into zhusuintable values (null, '$produName', '$weight', '$colorName', '$amount', '$date1', 'no', '$user1)"
Try {
//create objects needed to execute SQL statements
Val statement: statement=conn!!!!! CreateStatement ()
//executing SQL statements and retrieval information
Val num=statement. ExecuteUpdate (SQL)
If (num & gt; 0 {
The d (" AddColorName ", "has been added to the remote bottle preform injection library")
} else {
The d (" AddColorName ", "has been added to the remote bottle preform injection library")
}
{} the catch (e: SQLException)
The e (" AddColorName ", "remote data insertion failure")
}
} else {
Val SQL="insert into zhusuintable values (null, '$produName', '$weight', '$colorName', '$amount', '$date1', 'no', '$user1)"
Try {
//create objects needed to execute SQL statements
Val statement: statement=conn!!!!! CreateStatement ()
//execute SQL query and retrieve the query information
Val num=statement. ExecuteUpdate (SQL)
If (num & gt; 0 {
The d (" AddColorName ", "has been added to the remote bottle preform injection library")
} else {
The d (" AddColorName ", "has been added to the remote bottle preform injection library")
}
{} the catch (e: SQLException)
The e (" AddColorName ", "remote bottle preform injection failure data into 1")
}
}

} else {
The d (" the InBound ", "number can't be empty")
}
} else {
The d (" the InBound ", "weight can't be empty")
}
//close the database
Try {
Conn!!!!! The close ()
The d (" AddColorName ", "close the connection is successful,")
{} the catch (e: SQLException)
The d (" AddColorName ", "close the connection fails,")
}

}
{} the catch (e: Exception)
E.p rintStackTrace ()
}

}

CodePudding user response:

'$produName', '$' weight', '$colorName', '$amount', '$date1', 'no', '$user1'
That you try the variable name directly,

CodePudding user response:

Look not to understand I went to look elsewhere

CodePudding user response:

Don't understand, ask somewhere else

CodePudding user response:

Val SQL="insert into zhusuintable values (null , '$produName,
You feel this is the right input method
  • Related