Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. Update and Delete images from sqlserver2000 (vb.net 2005)

Update and Delete images from sqlserver2000 (vb.net 2005)

Scheduled Pinned Locked Moved Visual Studio
csharpdatabasegraphicshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    imam_hatake
    wrote on last edited by
    #1

    how to update and delete images from sqlserver2000 using vb.net, please help me.. this my code this code for search an image, i made some button for search image cz i want insert many image in one click button save, and its work :

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    Dim picturelocation As String
    a.Filter = "(*.jpg)|*.jpg|(*.bmp)|*.bmp|(*.pdf)|*.pdf|All files (*.*)|*.*"
    picturelocation = a.FileName
    Try
    If a.ShowDialog = Windows.Forms.DialogResult.OK Then
    'PictureBox1.Image = New Bitmap(a.FileName)
    TextBox7.Text = a.FileName
    'PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
    End If
    Button6.Focus()
    Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Information)
    End Try
    End Sub

    and this code for my button save n its work :

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
    Try
    If TextBox5.Text = "" Or TextBox6.Text = "" Then
    MsgBox("Lengkapi", MsgBoxStyle.Critical)
    If TextBox5.Text = "" Then
    TextBox5.Focus()
    ElseIf TextBox6.Text = "" Then
    TextBox6.Focus()
    ElseIf TextBox7.Text = "" Then
    Button5.Focus()
    End If
    Else
    Call koneksi()
    cmd = New SqlCommand("select * from tabel_karyawan where kode_karyawan='" & TextBox4.Text & "'", conn)
    rd = cmd.ExecuteReader
    rd.Read()
    If Not rd.HasRows Then
    If TextBox7.Text = "" And TextBox8.Text = "" And TextBox9.Text = "" And TextBox10.Text = "" And TextBox11.Text = "" And TextBox12.Text = "" Then
    Call koneksi()
    Using sql As New SqlClient.SqlCommand("insert into tabel_karyawan(kode_karyawan,nama_karyawan,nomor_ktp)values(@kode_karyawan,@nama_karyawan,@nomor_ktp)", conn)
    sql.Parameters.Add(New SqlClient.SqlParameter("@kode_karyawan", SqlDbType.Char)).Value = TextBox4.Text
    sql.Parameters.Add(New SqlClient.SqlParameter("@nama_karyawan", SqlDbType.VarChar)).Value = TextBox5.Text
    sql.Parameters.Add(New SqlClient.SqlParameter("@nomor_ktp", SqlDbType.V

    Richard DeemingR 1 Reply Last reply
    0
    • I imam_hatake

      how to update and delete images from sqlserver2000 using vb.net, please help me.. this my code this code for search an image, i made some button for search image cz i want insert many image in one click button save, and its work :

      Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
      Dim picturelocation As String
      a.Filter = "(*.jpg)|*.jpg|(*.bmp)|*.bmp|(*.pdf)|*.pdf|All files (*.*)|*.*"
      picturelocation = a.FileName
      Try
      If a.ShowDialog = Windows.Forms.DialogResult.OK Then
      'PictureBox1.Image = New Bitmap(a.FileName)
      TextBox7.Text = a.FileName
      'PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
      End If
      Button6.Focus()
      Catch ex As Exception
      MsgBox(ex.Message, MsgBoxStyle.Information)
      End Try
      End Sub

      and this code for my button save n its work :

      Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
      Try
      If TextBox5.Text = "" Or TextBox6.Text = "" Then
      MsgBox("Lengkapi", MsgBoxStyle.Critical)
      If TextBox5.Text = "" Then
      TextBox5.Focus()
      ElseIf TextBox6.Text = "" Then
      TextBox6.Focus()
      ElseIf TextBox7.Text = "" Then
      Button5.Focus()
      End If
      Else
      Call koneksi()
      cmd = New SqlCommand("select * from tabel_karyawan where kode_karyawan='" & TextBox4.Text & "'", conn)
      rd = cmd.ExecuteReader
      rd.Read()
      If Not rd.HasRows Then
      If TextBox7.Text = "" And TextBox8.Text = "" And TextBox9.Text = "" And TextBox10.Text = "" And TextBox11.Text = "" And TextBox12.Text = "" Then
      Call koneksi()
      Using sql As New SqlClient.SqlCommand("insert into tabel_karyawan(kode_karyawan,nama_karyawan,nomor_ktp)values(@kode_karyawan,@nama_karyawan,@nomor_ktp)", conn)
      sql.Parameters.Add(New SqlClient.SqlParameter("@kode_karyawan", SqlDbType.Char)).Value = TextBox4.Text
      sql.Parameters.Add(New SqlClient.SqlParameter("@nama_karyawan", SqlDbType.VarChar)).Value = TextBox5.Text
      sql.Parameters.Add(New SqlClient.SqlParameter("@nomor_ktp", SqlDbType.V

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      imam_hatake wrote:

      New SqlCommand("select * from tabel_karyawan where kode_karyawan='" & TextBox4.Text & "'", conn)

      Start by reading about SQL Injection[^], and then fixing all of your vulnerable queries. For example, in the query above, what do you think will happen if the user types the following into TextBox4?

      '; DELETE FROM tabel_karyawan;--


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups