vb.net - Mysql query returning null value and 0 results -
i have issue driving me crazy!
query = "select formula filterprice idcode='" & txtcodigo.text & "' , (filterdata<='" & cant & "')" dim selectcommand new mysqlcommand(query, conexion.conn) priceselected = conversions.tostring(selectcommand.executescalar()) conexion.desconecta() conexion.conn.dispose()
but return nothing, hint?
this detailed example data retrieval using parameterised queries :
dim con new mysqlconnection("data source=<server name>;initial catalog=<db name>; integrated security=true;") dim cmdselectdata new mysqlcommand("select formula filterprice idcode=@idcode , filterdata<=@cant", con) cmdselectdata.parameters.addwithvalue("@idcode", txtcodigo.text) cmdselectdata.parameters.addwithvalue("@cant", cant) if not con.state=connectionstate.open con.open() priceselected=cmdselectdata.executescalar() con.close()
this more secure way databases. hope helps.
Comments
Post a Comment