Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Data
  2. Imports System.Data.OleDb
  3. Imports System.Data.SqlClient
  4.  
  5.  
  6. Public Class demoform
  7.     Dim pass As String
  8.     Dim user As String
  9.  
  10.     Dim ds As New DataSet
  11.     Dim dr As DataRow
  12.     Dim dt As DataTable
  13.  
  14.  
  15.     Private Sub demoform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  16.  
  17.         LoginDialog.ShowDialog()
  18.  
  19.         '   dt = New DataTable("testtable")
  20.        '   dt.Columns.Add("col1", GetType(String))
  21.        '   dt.Columns.Add("blah", GetType(String))
  22.        '   dt.Columns.Add("cool", GetType(String))
  23.        '
  24.        '        ds.Tables.Add(dt)
  25.        '
  26.        '        dgvplay.DataSource = dt
  27.        '
  28.        '        dr = dt.NewRow()
  29.  
  30.         ' Dim connectstring = "Provider=SQLNCLI10;Server=PRESONIC-PC\FUNSQL;Database=pre_accounting;Uid=" & user & "; Pwd=" & pass & ";"
  31.        'Dim conn As New OleDbConnection(connectstring)
  32.        'conn.Open()
  33.  
  34.         '  ========================================= MORE SHIT ====================================
  35.        'Dim SQLStr As String
  36.        ''Dim ConStr As String
  37.        'SQLStr = "SELECT * FROM dbo.people"
  38.        'ConStr = "data source=sql.domain.no; initial catalog=xxxxx; User ID=xxxxx;pwd=xxxxx; Integrated Security=SSPI"
  39.        'ConStr = "data source=localhost; initial catalog=pre_accounting; User ID=" & user & ";pwd=" & pass & "; Integrated Security=SSPI"
  40.  
  41.         '       Try
  42.        ' Dim sqlConn As New System.Data.SqlClient.SqlConnection(ConStr)
  43.        ' Dim SQLAdapter As New System.Data.SqlClient.SqlDataAdapter(SQLStr, sqlConn)
  44.        ''SQLAdapter.Fill(ds)
  45.        'Catch ex As Exception
  46.        ' MsgBox(ex.Message, 1, "ERROR1")
  47.        ' End Try
  48.  
  49.         ' SQLAdapter.Fill(ds)
  50.  
  51.         ' Dim sConnection As String = "server=(local);uid=" & user & ";pwd=" & pass & ";database=pre_accounting"
  52.  
  53.         Dim sConnection = "Server=PRESONIC-PC\FUNSQL;Database=pre_accounting;Uid=" & user & "; Pwd=" & pass & ";"
  54.  
  55.  
  56.         Dim objDataAdapter As New SqlDataAdapter("Select * From people", sConnection)
  57.  
  58.  
  59.         Dim dsResult As New DataSet("Result")
  60.  
  61.         If Not IsNothing(objDataAdapter) Then
  62.             ' Fill data into dataset
  63.            objDataAdapter.Fill(dsResult)
  64.  
  65.             objDataAdapter.Dispose()
  66.         End If
  67.  
  68.  
  69.     End Sub
  70.  
  71.     Public Sub userpass_pass(ByVal the_user As String, ByVal the_pass As String)
  72.         user = the_user
  73.         pass = the_pass
  74.     End Sub
  75. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement