Click here to Skip to main content
16,004,404 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
The initial incrementation of m_RowPosition came by the fill command by means of starting at 0 to fill my virtual table if would call it that





I stepped through it but I can't see that it tells me that my values won't change. . . Im still a beginner at this so please bare with me here.












Hey I took the advice on getting books but after that I am stuck , I am trying to create a TEXBOX that wil lookup mutiple fields in my DB but it always returns the same value. . . have a look at the code and see if anyone can help,

Private m_cnADONetConnection As New OleDb.OleDbConnection()
Private m_daDataAdapter As OleDb.OleDbDataAdapter
Private m_cbCommandBuilder As OleDb.OleDbCommandBuilder
Private m_dtCD As New DataTable
Dim m_rowPosition As Integer = 0

Private Sub StockDetailsForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
m_cnADONetConnection.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TEST.mdb"

m_cnADONetConnection.Open()

m_daDataAdapter = New OleDb.OleDbDataAdapter("Select * From CD", m_cnADONetConnection)
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)
m_daDataAdapter.Fill(m_dtCD)


Public Sub StockCheck()

StockEdit_Open_Conn()
Dim sql = "SELECT CouplingCode ,AlbumTitle ,ReleaseDate ,TotalSongs ,PPD FROM CD WHERE CouplingCode='" & StockDetailsForm.txtSearch.Text & "'"
Dim cmd As New System.Data.OleDb.OleDbCommand

cmd = New OleDbCommand(sql, m_cnADONetConnection)
Dim exReader As OleDbDataReader = cmd.ExecuteReader
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)


Private Sub txtSearch_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.Leave

Try
If exReader.Read = False Then
MessageBox.Show("Stock Item does not exist", "Stock Item Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
m_cnADONetConnection.Close()
m_cnADONetConnection.Dispose()
Else
StockDetailsForm.CouplingCodeID.Text = _
m_dtCD.Rows(m_rowPosition)("CouplingCode").ToString()
StockDetailsForm.txtAlbumName.Text = _
m_dtCD.Rows(m_rowPosition)("AlbumTitle").ToString()
StockDetailsForm.txtPPD.Text = _
m_dtCD.Rows(m_rowPosition)("PPD").ToString()
StockDetailsForm.txtTotalSongs.Text = _
m_dtCD.Rows(m_rowPosition)("TotalSongs").ToString()
StockDetailsForm.dtpReleaseDate.Text = _
m_dtCD.Rows(m_rowPosition)("ReleaseDate").ToString()
StockDetailsForm.txtQtyHand.Text = _
m_dtCD.Rows(m_rowPosition)("QtyOnHand").ToString()
End If
End Sub
Posted
Updated 15-Jan-10 13:14pm
v3

1 solution

A textbox can't look up anything. Do you mean that you intend to increment m_RowPosition somewhere ? Have you stepped through the code in the debugger ? If it always shows the same value, I suspect this is becasue this variable does not change. Looking at the debugger would tell you that
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900