Ovako zapisujes u bazu
Code:
Dim veza as new SQLConnection("connectionstring")
dim Kom as new SQLCommand("",veza)
dim cit as SQLDataReader
TRy
veza.open
kom.commandtext="INSERT into mojaTabela(ime) values('"& textbox1.text &'')"
kom.executenonquery
veza.close
catch ex as SQLException
msgbox ex.message
end try
A ovako citas iz baze:
Code:
TRy
veza.open
kom.commandtext="select ime from mojaTabela where id=1"
cit=kom.executereader
cit.read
textbox1.text=cit.item("ime")
cit.close
veza.close
catch ex as SQLException
msgbox ex.message
end try