CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #1
    Join Date
    Oct 2012
    Posts
    11

    Problems connecting to database

    Hi

    I want to become a bank , but , This line has errors: da.Fill(ds, "f12")

    Where is the problem?
    Thank


    Code:
    Imports System.Data
    Imports System.Data.SqlClient
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim strsql As String
            Dim strcon As String
            strcon = "Data Source=.;Integrated Security=True"
    
            Dim con As New SqlConnection(strCon)
            con.Open()
            strsql = "select * from f12"
            Dim da As New SqlDataAdapter(strsql, con)
            Dim ds As New DataSet()
            da.Fill(ds, "f12")
            DataGrid1.DataBindings.Add(New Binding("dataource", da, "f12"))
            con.Close()
        End Sub
    End Class
    Last edited by ali 254; September 28th, 2013 at 10:04 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured