The only thing I will say that I had to learn is, your initial steps will be
to use the controls to do all the work for you.
It seems to me that when you do it that way, it becomes hard to customize,
whereas if you actually code it line by line it just seems a lot easier to
work with as in the following vb.net code to make a flatfile
Another confusing thing is in vb.net you call a field name one way and in
asp_net you call it a different way.
I tried many times to get the following code done using the controls, and
then I finally met a .net developer and once he showed me the basics of it,
I was off and running.
Problem is, you don't seem to find this stuff in the samples you find on the
net.
---
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class MakeFlatFile
Dim m_adinum As String
Dim m_model As String
Dim m_asset As String
'Dim m_serial As String 806
'Dim m_status As Integer 806
Dim m_empID As String
Dim m_last_name As String
Dim m_first_name As String
Dim m_chk_out As Date
Dim m_chk_in As Date
'Dim m_comments As String 806
Private Sub MakeFlatFile_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
GetAccessData("", "", "")
End Sub
Public Function GetAccessData(ByVal UID As String, ByVal pwd As String,
ByVal artist As String)
Dim conn As New OleDbConnection
Dim cmd806 As New OleDbCommand
Dim cmd807 As New OleDbCommand
Dim connString As String
connString = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data
Source=h:\inventory_tracker.mdb"
conn.ConnectionString = connString
conn.Open()
cmd807.Connection = conn
cmd807.CommandText = " Select * from T807"
Dim ds807 As New DataSet
Dim da807 As New OleDbDataAdapter(cmd807.CommandText,
conn.ConnectionString)
Dim dr807 As OleDbDataReader = cmd807.ExecuteReader()
da807.Fill(ds807, "vjb_807")
Dim m_idNUMBER As Integer
m_idNUMBER = 2
Me.Show()
Do While dr807.Read()
If dr807.Item("C1028000004").ToString = "" Then
Else
m_adinum = dr807.Item("C1028000004")
End If
If dr807.Item("C1028000001").ToString = "" Then
Else
m_model = dr807.Item("C1028000001")
End If
If dr807.Item("C1028000003").ToString = "" Then
Else
m_asset = dr807.Item("C1028000003")
End If
' vjb - get history from laptop file
'm_comments = dr806.item("C1028000009")
'm_serial = dr806.Item("C1028000002")
'm_status = dr806.Item("C1028000005")
If dr807.Item("C240000006").ToString = "" Then
Else
m_empID = dr807.Item("C240000006")
End If
If dr807.Item("C240000001").ToString = "" Then
Else
m_last_name = dr807.Item("C240000001")
End If
Dim delimStr As String = " "
Dim delimiter As Char() = delimStr.ToCharArray()
Dim words As String = m_last_name
Dim split As String() = Nothing
Dim x As Integer
For x = 1 To 3
split = words.Split(delimiter, x)
'Console.WriteLine(ControlChars.Cr + "count = {0,2}
..............", x)
Dim s As String
Dim pass As Integer
pass = 1
For Each s In split
'Console.WriteLine("-{0}-", s)
If pass = 1 Then
Label1.Text = s
End If
If pass = 2 Then
Label2.Text = s
End If
If pass = 3 Then
Label3.Text = s
End If
pass = pass + 1
Next s
Next x
Label4.Text = m_last_name
' vjb - need to build the names here
' vjb - automatically assume we have a first and last name, need
to compensate for the middle name
If Label3.Text = "" Then
' only have two variables for the name
m_last_name = Label2.Text
m_first_name = Label1.Text
Else
' must have three parts to the name
m_last_name = Label3.Text
m_first_name = Label1.Text + " " + Label2.Text
End If
Label5.Text = m_last_name
Label6.Text = m_first_name
'MsgBox("check it out")
If dr807.Item("C240000001").ToString = "" Then
Else
m_first_name = dr807.Item("C240000001")
End If
If dr807.Item("checked_out").ToString = "" Then
Else
m_chk_out = dr807.Item("checked_out")
End If
If dr807.Item("checked_in").ToString = "" Then
'm_chk_in =
Else
m_chk_in = dr807.Item("checked_in")
End If
Me.Refresh()
subUpdateRecords()
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
Label6.Text = ""
m_idNUMBER = m_idNUMBER + 1
Loop
'cmd807.Connection = conn
'cmd807.CommandText = " Select * from T807"
'Dim ds807 As New DataSet
'Dim da807 As New OleDbDataAdapter(cmd807.CommandText,
conn.ConnectionString)
'Dim dr807 As OleDbDataReader = cmd807.ExecuteReader()
'da807.Fill(ds807, "vjb_807")
MsgBox("Connection established")
conn.Close()
End Function
Public Sub subUpdateRecords()
Dim strConn As String
Dim strSQL As String
strConn = "provider=Microsoft.Jet.OLEDB.4.0; Data
Source=h:\inventory_tracker.mdb"
'strSQL = "insert into laptop_inventory (ADINUM, model_type,
asset_tag, emp_ID, emp_last_name, emp_first_name, [date_checked_out],
[date_checked_in], comments") VALUES (m_empID, m_adinum, m_model, m_asset,
m_empID, m_last_name, m_first_name, [m_chk_out], [m_chk_in])"
strSQL = "insert into laptop_inventory (ADINUM, model_type,
asset_tag, emp_ID, emp_last_name, emp_first_name, date_checked_out,
date_checked_in) VALUES ('" & m_adinum & "','" & m_model & "','" & m_asset &
"','" & m_empID & "','" & Label5.Text & "','" & Label6.Text & "','" &
m_chk_out & "','" & m_chk_in & "')"
Dim cn As New OleDbConnection(strConn)
Dim cmd As New OleDbCommand(strSQL, cn)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Sub
End Class
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.