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
R

Roland Skeyhill

@Roland Skeyhill
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • how to check if value exists in database from textbox c#
    R Roland Skeyhill

    t's not hard, it's easy - once you learn how to do it. Just to add to what Richard gave you, the whole code is along the lines of:

    using (SqlConnection con = new SqlConnection(strConnect))
    {
    con.Open();
    using (SqlCommand cmd = new SqlCommand("SELECT Age, Description FROM myTable WHERE ID = @ID", con))
    {
    cmd.Parameters.AddWithValue("@ID", myTextBox.Text);
    using (SqlDataReader reader = cmd.ExecuteReader())
    {
    while (reader.Read())
    {
    int age = (int) reader["Age"];
    string desc = (string) reader["Description"];
    Console.WriteLine($"{age}\n{desc}");
    }
    }
    }
    }

    :laugh: :cool:

    C# csharp database tutorial
  • Login

  • Don't have an account? Register

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