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. General Programming
  3. Visual Basic
  4. my vb.net code

my vb.net code

Scheduled Pinned Locked Moved Visual Basic
csharpsecurity
5 Posts 5 Posters 1 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.
  • J Offline
    J Offline
    JAYRAJ GIRI
    wrote on last edited by
    #1

    Public Class Form12 Dim ds As New DataSet Dim da As New SqlClient.SqlDataAdapter Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CN As New SqlClient.SqlConnection CN.ConnectionString = "Data Source=homepc\sqlexpress;Initial Catalog=Northwind;Integrated Security=True" Dim cmd As New SqlClient.SqlCommand cmd.Connection = CN cmd.CommandText = "Select * From Customers" da.SelectCommand = cmd da.Fill(ds, "Customers") da.Fill(ds, "CustomersDummy") Dim PK(0) As DataColumn PK(0) = ds.Tables("Customers").Columns("CustomerId") ds.Tables("Customers").PrimaryKey = PK MsgBox("ok") Me.DataGridView1.DataSource = ds Me.DataGridView1.DataMember = "Customers" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(Me.ds.Tables.Count) Me.ComboBox1.Items.Clear() For Each tbl As DataTable In ds.Tables Me.ComboBox1.Items.Add(tbl.TableName) Next End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Me.ComboBox2.Items.Clear() For Each col As DataColumn In tbl.Columns Me.ComboBox2.Items.Add(col.ColumnName) Next End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Dim Ans As String = "" For Each dr As DataRow In tbl.Rows Ans &= dr.Item(Me.ComboBox2.SelectedItem) & ", " Next MsgBox(Ans) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim dr As DataRow Dim Str As String = InputBox("Enter Customerid") dr = ds.Tables("Customers").Rows.Find(Str) If dr Is Nothing Then MsgBox("Not found...") Exit Sub End If MsgBox(dr.Item("ContactName") & "-" & dr.Item("Country")) dr.BeginEdit() dr.Item("ContactName") = "Mr. " & dr.Item("ContactName") dr.Item("Country") = dr.Item("Country").ToString.ToUpper dr.End

    L D D 3 Replies Last reply
    0
    • J JAYRAJ GIRI

      Public Class Form12 Dim ds As New DataSet Dim da As New SqlClient.SqlDataAdapter Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CN As New SqlClient.SqlConnection CN.ConnectionString = "Data Source=homepc\sqlexpress;Initial Catalog=Northwind;Integrated Security=True" Dim cmd As New SqlClient.SqlCommand cmd.Connection = CN cmd.CommandText = "Select * From Customers" da.SelectCommand = cmd da.Fill(ds, "Customers") da.Fill(ds, "CustomersDummy") Dim PK(0) As DataColumn PK(0) = ds.Tables("Customers").Columns("CustomerId") ds.Tables("Customers").PrimaryKey = PK MsgBox("ok") Me.DataGridView1.DataSource = ds Me.DataGridView1.DataMember = "Customers" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(Me.ds.Tables.Count) Me.ComboBox1.Items.Clear() For Each tbl As DataTable In ds.Tables Me.ComboBox1.Items.Add(tbl.TableName) Next End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Me.ComboBox2.Items.Clear() For Each col As DataColumn In tbl.Columns Me.ComboBox2.Items.Add(col.ColumnName) Next End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Dim Ans As String = "" For Each dr As DataRow In tbl.Rows Ans &= dr.Item(Me.ComboBox2.SelectedItem) & ", " Next MsgBox(Ans) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim dr As DataRow Dim Str As String = InputBox("Enter Customerid") dr = ds.Tables("Customers").Rows.Find(Str) If dr Is Nothing Then MsgBox("Not found...") Exit Sub End If MsgBox(dr.Item("ContactName") & "-" & dr.Item("Country")) dr.BeginEdit() dr.Item("ContactName") = "Mr. " & dr.Item("ContactName") dr.Item("Country") = dr.Item("Country").ToString.ToUpper dr.End

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Since you didn't ask a question I will: do you already have any idea why you are getting more 1-votes than you have posted messages around here? :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


      C 1 Reply Last reply
      0
      • J JAYRAJ GIRI

        Public Class Form12 Dim ds As New DataSet Dim da As New SqlClient.SqlDataAdapter Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CN As New SqlClient.SqlConnection CN.ConnectionString = "Data Source=homepc\sqlexpress;Initial Catalog=Northwind;Integrated Security=True" Dim cmd As New SqlClient.SqlCommand cmd.Connection = CN cmd.CommandText = "Select * From Customers" da.SelectCommand = cmd da.Fill(ds, "Customers") da.Fill(ds, "CustomersDummy") Dim PK(0) As DataColumn PK(0) = ds.Tables("Customers").Columns("CustomerId") ds.Tables("Customers").PrimaryKey = PK MsgBox("ok") Me.DataGridView1.DataSource = ds Me.DataGridView1.DataMember = "Customers" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(Me.ds.Tables.Count) Me.ComboBox1.Items.Clear() For Each tbl As DataTable In ds.Tables Me.ComboBox1.Items.Add(tbl.TableName) Next End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Me.ComboBox2.Items.Clear() For Each col As DataColumn In tbl.Columns Me.ComboBox2.Items.Add(col.ColumnName) Next End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Dim Ans As String = "" For Each dr As DataRow In tbl.Rows Ans &= dr.Item(Me.ComboBox2.SelectedItem) & ", " Next MsgBox(Ans) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim dr As DataRow Dim Str As String = InputBox("Enter Customerid") dr = ds.Tables("Customers").Rows.Find(Str) If dr Is Nothing Then MsgBox("Not found...") Exit Sub End If MsgBox(dr.Item("ContactName") & "-" & dr.Item("Country")) dr.BeginEdit() dr.Item("ContactName") = "Mr. " & dr.Item("ContactName") dr.Item("Country") = dr.Item("Country").ToString.ToUpper dr.End

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Well, it's obvious you don't have a clue how to use a forum. You have 20 posts, and have yet to ask a question anyone can answer.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        1 Reply Last reply
        0
        • J JAYRAJ GIRI

          Public Class Form12 Dim ds As New DataSet Dim da As New SqlClient.SqlDataAdapter Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim CN As New SqlClient.SqlConnection CN.ConnectionString = "Data Source=homepc\sqlexpress;Initial Catalog=Northwind;Integrated Security=True" Dim cmd As New SqlClient.SqlCommand cmd.Connection = CN cmd.CommandText = "Select * From Customers" da.SelectCommand = cmd da.Fill(ds, "Customers") da.Fill(ds, "CustomersDummy") Dim PK(0) As DataColumn PK(0) = ds.Tables("Customers").Columns("CustomerId") ds.Tables("Customers").PrimaryKey = PK MsgBox("ok") Me.DataGridView1.DataSource = ds Me.DataGridView1.DataMember = "Customers" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(Me.ds.Tables.Count) Me.ComboBox1.Items.Clear() For Each tbl As DataTable In ds.Tables Me.ComboBox1.Items.Add(tbl.TableName) Next End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Me.ComboBox2.Items.Clear() For Each col As DataColumn In tbl.Columns Me.ComboBox2.Items.Add(col.ColumnName) Next End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim tbl As DataTable = ds.Tables(Me.ComboBox1.SelectedItem) Dim Ans As String = "" For Each dr As DataRow In tbl.Rows Ans &= dr.Item(Me.ComboBox2.SelectedItem) & ", " Next MsgBox(Ans) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim dr As DataRow Dim Str As String = InputBox("Enter Customerid") dr = ds.Tables("Customers").Rows.Find(Str) If dr Is Nothing Then MsgBox("Not found...") Exit Sub End If MsgBox(dr.Item("ContactName") & "-" & dr.Item("Country")) dr.BeginEdit() dr.Item("ContactName") = "Mr. " & dr.Item("ContactName") dr.Item("Country") = dr.Item("Country").ToString.ToUpper dr.End

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          Are you using this site as a tool for source control?

          Time is the best teacher; unfortunately it kills all of its students. जय हिंद

          1 Reply Last reply
          0
          • L Luc Pattyn

            Since you didn't ask a question I will: do you already have any idea why you are getting more 1-votes than you have posted messages around here? :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            This guy is a retard. Seriously, he posts like this every day.

            Christian Graus Driven to the arms of OSX by Vista.

            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