B
boskomihic
Guest
Code:
Dim cn As New OleDb.OleDbConnection()
Dim cm As New OleDb.OleDbCommand()
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=D:\My Documents\Visual Studio Projects\Adresar\Adresar.mdb;Mode=ReadWrite"
Try
cn.Open()
cm.Connection = cn
cm.CommandText = "UPDATE Podaci SET Podaci.Ime = [@Ime], Podaci.Prezime = [@Prezime], Podaci.Datum = [@Datum], Podaci.Adresa = [@Adresa], Podaci.Fixni = [@Fixni], " & _
"Podaci.Mobilni = [@Mobilni], Podaci.Email = [@Email], Podaci.Home = [@Home], Podaci.Slika1 = [@Slika1], Podaci.Slika2 = [@Slika2], Podaci.[Note] = [@Note] WHERE (((Podaci.ID)=[@ID]));"
cm.Parameters.Add(New OleDb.OleDbParameter("@ID", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Ime", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Prezime", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Datum", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Adresa", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Fixni", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Mobilni", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Email", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Home", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Slika1", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Slika2", OleDb.OleDbType.VarChar))
cm.Parameters.Add(New OleDb.OleDbParameter("@Note", OleDb.OleDbType.VarChar))
cm.Parameters("@ID").Value = EditID
cm.Parameters("@Ime").Value = txtIme.Text
Debug.WriteLine(txtIme.Text)
cm.Parameters("@Prezime").Value = txtPrezime.Text
cm.Parameters("@Datum").Value = txtDatum.Text
cm.Parameters("@Adresa").Value = txtAdresa.Text
cm.Parameters("@Fixni").Value = txtFixni.Text
cm.Parameters("@Mobilni").Value = txtMobilni.Text
cm.Parameters("@Email").Value = llblEMail.Text
cm.Parameters("@Home").Value = llblWeb.Text
cm.Parameters("@Slika1").Value = pic1.Text
cm.Parameters("@Slika2").Value = pic2.Text
cm.Parameters("@Note").Value = txtNote.Text
cm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
Finally
cn.Close()
End Try
But, even if I dont get any error message, this code doesnt work anything (everything stays same).
Why?
Whats wrong?