Expand|Select|Wrap|Line Numbers
- Public Function Connection() As String
- Return "Data Source=192.168.0.1,1433;Network Library=DBMSSOCN;Initial Catalog=test;User ID=sa;Password=123456"
- End Function
Expand|Select|Wrap|Line Numbers
- Imports System.Data.SqlClient
- Public Class Form1
- Inherits System.Windows.Forms.Form
- Dim CONNECTION_STRING As String = Connection()
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Dim Connection As New SqlClient.SqlConnection(CONNECTION_STRING)
- Dim ds As New DataSet
- Dim sql As String = "SELECT * FROM tblname"
- Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(sql, Connection)
- Try
- da.Fill(ds, "tblname")
- Finally
- da.Dispose()
- End Try
- Me.TextBox1.DataBindings.Add("Text", ds, "firstname")
- Me.TextBox1.DataBindings.Add("Text", ds, "lastname")
- End Sub
What is wrong and how can i achieve this..please direct me.