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 Basic
  4. what is this?

what is this?

Scheduled Pinned Locked Moved Visual Basic
questionc++comsecurity
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.
  • H Offline
    H Offline
    hassanasp
    wrote on last edited by
    #1

    Hello, I am a newby to Visual Basic.. I have been having some problems with adding my data in my program. I am using Vb2005 and trying to use sotored procedure but h have error on run time message error : No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type This is what I have so far : Dim con As New System.Data.SqlClient.SqlConnection("Data Source=.;Initial Catalog=School;Integrated Security=True") Dim com As New System.Data.SqlClient.SqlCommand("proce_school_info", con) com.CommandType = CommandType.StoredProcedure com.Parameters.AddWithValue("@School_NameAr", Me.textBox1.Text) com.Parameters.AddWithValue("@School_NameEn", Me.textBox2.Text) com.Parameters.AddWithValue("@School_Edara ", Me.textBox3.Text) com.Parameters.AddWithValue("@School_Address", Me.textBox4) com.Parameters.AddWithValue("@School_City", Me.textBox5) com.Parameters.AddWithValue("@School_Nation ", Me.textBox6.Text) com.Parameters.AddWithValue("@School_Phone", CType(Me.textBox7.Text, Integer)) com.Parameters.AddWithValue("@School_Fax", CType(Me.textBox8.Text, Integer)) com.Parameters.AddWithValue("@School_Email", Me.textBox9.Text) 'com.Parameters.AddWithValue("@School_City", Me.textBox8.Text) com.Parameters.AddWithValue("@School_Country", Me.textBox10.Text) com.Parameters.AddWithValue("@School_Abbrev", Me.textBox11.Text) com.Parameters.AddWithValue("@School_FirstYear", Me.textBox12.Text) con.Open() com.ExecuteNonQuery() con.Close()

    Ahmed hassan

    C 1 Reply Last reply
    0
    • H hassanasp

      Hello, I am a newby to Visual Basic.. I have been having some problems with adding my data in my program. I am using Vb2005 and trying to use sotored procedure but h have error on run time message error : No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type This is what I have so far : Dim con As New System.Data.SqlClient.SqlConnection("Data Source=.;Initial Catalog=School;Integrated Security=True") Dim com As New System.Data.SqlClient.SqlCommand("proce_school_info", con) com.CommandType = CommandType.StoredProcedure com.Parameters.AddWithValue("@School_NameAr", Me.textBox1.Text) com.Parameters.AddWithValue("@School_NameEn", Me.textBox2.Text) com.Parameters.AddWithValue("@School_Edara ", Me.textBox3.Text) com.Parameters.AddWithValue("@School_Address", Me.textBox4) com.Parameters.AddWithValue("@School_City", Me.textBox5) com.Parameters.AddWithValue("@School_Nation ", Me.textBox6.Text) com.Parameters.AddWithValue("@School_Phone", CType(Me.textBox7.Text, Integer)) com.Parameters.AddWithValue("@School_Fax", CType(Me.textBox8.Text, Integer)) com.Parameters.AddWithValue("@School_Email", Me.textBox9.Text) 'com.Parameters.AddWithValue("@School_City", Me.textBox8.Text) com.Parameters.AddWithValue("@School_Country", Me.textBox10.Text) com.Parameters.AddWithValue("@School_Abbrev", Me.textBox11.Text) com.Parameters.AddWithValue("@School_FirstYear", Me.textBox12.Text) con.Open() com.ExecuteNonQuery() con.Close()

      Ahmed hassan

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      hassanasp wrote:

      com.Parameters.AddWithValue("@School_NameAr", Me.textBox1.Text) com.Parameters.AddWithValue("@School_NameEn", Me.textBox2.Text) com.Parameters.AddWithValue("@School_Edara ", Me.textBox3.Text) com.Parameters.AddWithValue("@School_Address", Me.textBox4) com.Parameters.AddWithValue("@School_City", Me.textBox5) com.Parameters.AddWithValue("@School_Nation ", Me.textBox6.Text) com.Parameters.AddWithValue("@School_Phone", CType(Me.textBox7.Text, Integer)) com.Parameters.AddWithValue("@School_Fax", CType(Me.textBox8.Text, Integer)) com.Parameters.AddWithValue("@School_Email", Me.textBox9.Text) 'com.Parameters.AddWithValue("@School_City", Me.textBox8.Text) com.Parameters.AddWithValue("@School_Country", Me.textBox10.Text) com.Parameters.AddWithValue("@School_Abbrev", Me.textBox11.Text) com.Parameters.AddWithValue("@School_FirstYear", Me.textBox12.Text)

      I've bolded two lines above. You will notice that the lines in bold are missing something that the other lines have. That is the .Text property. And, by the way, naming your text boxes as textBox1, textBox2, etc. won't win you any friends. Please give them better names because the person that comes after you to maintain your code will curse you for it. And if you end up having to maintain the code you'll end up cursing yourself.


      Upcoming FREE developer events: * Developer Day Scotland My website | blog

      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