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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. help me inserting in database the arabic characters

help me inserting in database the arabic characters

Scheduled Pinned Locked Moved ASP.NET
databasehelpworkspace
3 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.
  • M Offline
    M Offline
    Mogaambo
    wrote on last edited by
    #1

    // Tell me how where i am going wrong public int InsertMake(Create_make_bean makedetails) { String connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(connectionstring)) { String strquery; strquery = "insert into year_tb ("; strquery += "year,make,model"; strquery += ") "; strquery += "values(@year, @make, @model)"; SqlCommand cmd = new SqlCommand(strquery, con); cmd.Parameters.AddWithValue("@year", 'N'+makedetails.year); cmd.Parameters.AddWithValue("@make", 'N'+makedetails.make); cmd.Parameters.AddWithValue("@model",'N'+makedetails.model); try { con.Open(); int inserted = cmd.ExecuteNonQuery(); return inserted; } catch(Exception ex) { return 0; } finally { con.Close(); } } }

    K 1 Reply Last reply
    0
    • M Mogaambo

      // Tell me how where i am going wrong public int InsertMake(Create_make_bean makedetails) { String connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(connectionstring)) { String strquery; strquery = "insert into year_tb ("; strquery += "year,make,model"; strquery += ") "; strquery += "values(@year, @make, @model)"; SqlCommand cmd = new SqlCommand(strquery, con); cmd.Parameters.AddWithValue("@year", 'N'+makedetails.year); cmd.Parameters.AddWithValue("@make", 'N'+makedetails.make); cmd.Parameters.AddWithValue("@model",'N'+makedetails.model); try { con.Open(); int inserted = cmd.ExecuteNonQuery(); return inserted; } catch(Exception ex) { return 0; } finally { con.Close(); } } }

      K Offline
      K Offline
      Kannan Coder
      wrote on last edited by
      #2

      use nvarchar data type to store unicode characters. By the way is this code makes any errors?

      M 1 Reply Last reply
      0
      • K Kannan Coder

        use nvarchar data type to store unicode characters. By the way is this code makes any errors?

        M Offline
        M Offline
        Mogaambo
        wrote on last edited by
        #3

        sorted out, i am using year as column name and year in mssqlserver is reserved

        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