473,373 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,373 software developers and data experts.

SQL Update - DataViewRow

I'm very new to VB.NET 2003

Here is what I have accomplished:

MainSelectForm - Selects an item

In a public class I pass a DataViewRow to

ItemInformation1 Form
ItemInformation2 Form
..
..
ItemInformation7 Form

I am able to get from the DataViewRow
I am able to put data back into the DataViewRow
As I go Forward and Backwards between the ItemInformationForm[1-7] all the
data I change is available and working

I feel pretty good about my first attempt to VB.NET

Now what I want to do:

Setup a button on all ItemInformation[1-7] Forms to do an update
In the public class setup a variable that I can change when clicking on the
Update button to denote an update is needed

From within MainSelectForm do the update from the DataViewRow in the public
class

My questions are:

1. How do I check the Update Flag? (I've migrated from COBOL where I would
be able to check the update flag in a linkage section, I do not know how to
do this in OO because I do not have control)
2. IS the a way to do an SQL Update via the DataViewRow without having to do
the Update listing all the fields and the WHERE clause, I have over 100
fields?
3. I should be able to click an Update button from within any Form and close
Form after Form until getting back to MainSelectForm where the Update would
occur

Any assistance would be greatly apprecited,
Thanks,
Jun 18 '06 #1
5 2578
Stephen,

You have given a lot of information and still it is not easy to help you.
Therefore some explanations.

A datarowview is a view on a datarow not to real datarow. You can get it by
Datarowview.row

If you do an update than you can do using the DataAdapter a datarow, there
is nothing wrong with.

If you need more information, because we are here very basic.
- did you generate the dataadapter (and with that the update commands)
- what controls did you use
- did you use databinding

I hope this helps sofar,

Cor

"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:n5******************************@giganews.com ...
I'm very new to VB.NET 2003

Here is what I have accomplished:

MainSelectForm - Selects an item

In a public class I pass a DataViewRow to

ItemInformation1 Form
ItemInformation2 Form
.
.
ItemInformation7 Form

I am able to get from the DataViewRow
I am able to put data back into the DataViewRow
As I go Forward and Backwards between the ItemInformationForm[1-7] all the
data I change is available and working

I feel pretty good about my first attempt to VB.NET

Now what I want to do:

Setup a button on all ItemInformation[1-7] Forms to do an update
In the public class setup a variable that I can change when clicking on
the Update button to denote an update is needed

From within MainSelectForm do the update from the DataViewRow in the
public class

My questions are:

1. How do I check the Update Flag? (I've migrated from COBOL where I would
be able to check the update flag in a linkage section, I do not know how
to do this in OO because I do not have control)
2. IS the a way to do an SQL Update via the DataViewRow without having to
do the Update listing all the fields and the WHERE clause, I have over 100
fields?
3. I should be able to click an Update button from within any Form and
close Form after Form until getting back to MainSelectForm where the
Update would occur

Any assistance would be greatly apprecited,
Thanks,

Jun 19 '06 #2
Thanks for the help!

I use two data adapters; the first is used to great the data grid. After a
record is selected via the DataGrid or a lookup field and button to execute
the value in the field and find the record from a second data adapter that
was greated with a "SELECT *".

Onve I find the DataViewRow within the second data adapter I pass it in the
Public class to all the forms. I can get data to and get back into the
dataviewrow without any incident. I'm assuming that at any point in any of
the screens I could do the update from the DataViewRow (I'd have no idea how
to do this). My goes would be that an "Update" button would reside on each
form and if the users clicks the Update button an UpdateFlag in the Public
CLass would be set.

At that point I want to check the Update Flag and keep going backwards until
I get to the main form and perform an update using the values in the
DataViewRow.

I than stay in the main form and the user can select another item and go
from there.

Steve
Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1
as ADDRESS, SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE"

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

myFormLibrary.StoreInformation1 = Me

myFormLibrary.StoreInformation2 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation5 = Me

myFormLibrary.StoreInformation6 = Me

myFormLibrary.StoreInformation7 = Me

PopulateStoreGrid()

'

' Create a Grid Table Style. Map it to the "Customers" Table.

'

Dim aGridTableStyle As New DataGridTableStyle

aGridTableStyle.MappingName = "BENMOOR1"

'

' Create GridColumnStyle objects for the grid columns

'

Dim aCol1 As New DataGridTextBoxColumn

Dim aCol2 As New DataGridTextBoxColumn

Dim aCol3 As New DataGridTextBoxColumn

Dim aCol4 As New DataGridTextBoxColumn

Dim aCol5 As New DataGridTextBoxColumn

Dim aCol6 As New DataGridTextBoxColumn

'

With aCol1

..HeaderText = "BM#"

..MappingName = "BM_NUMBER"

..Width = 45

..TextBox.Enabled = False

End With

'

' Set column 2's caption, width and disable editing.

'

With aCol2

..MappingName = "STORE_NUMBER"

..HeaderText = "Store#"

..Width = 40

..Alignment = HorizontalAlignment.Left

..TextBox.Enabled = False

End With

With aCol3

..MappingName = "STORE"

..HeaderText = "Store Name"

..Width = 200

..Alignment = HorizontalAlignment.Left

' .NullText = ""

..TextBox.Enabled = False

End With

With aCol4

..MappingName = "ADDRESS"

..HeaderText = "Store Address"

..Width = 200

..Alignment = HorizontalAlignment.Left

'.NullText = "0"

..TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol5

..MappingName = "CITY"

..HeaderText = "CIty"

..Width = 100

..Alignment = HorizontalAlignment.Left

'.NullText = "0"

..TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol6

..MappingName = "STATE"

..HeaderText = "St."

..Width = 30

..Alignment = HorizontalAlignment.Left

'.NullText = "0"

..TextBox.Enabled = False

'.Format = "#0.00"

End With

'

' Add the GridColumnStyles to the DataGrid's Column Styles collection.

'

With aGridTableStyle.GridColumnStyles

..Add(aCol1)

..Add(aCol2)

..Add(aCol3)

..Add(aCol4)

..Add(aCol5)

..Add(aCol6)

End With

'

' Add the GridColumnStyles to the aGridTableStyle.

'

DataGrid1.TableStyles.Add(aGridTableStyle)

End Sub

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.DoubleClick

Dim StoreNo1 As String

Dim Storeno2 As String

Dim checkarea As String

Dim irow As Integer = DataGrid1.CurrentCell.RowNumber

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Dim frminfo As New StoreInformation

'Set up values for storeinfor screen

frminfo.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo.MailToName.Text = myDV(rowIndex)("MAIL_NAME").ToString()

frminfo.MailToAdd1.Text = myDV(rowIndex)("MAIL_ADDRESS1").ToString()

frminfo.MailToAdd2.Text = myDV(rowIndex)("MAIL_ADDRESS2").ToString()

frminfo.MailToCity.Text = myDV(rowIndex)("MAIL_CITY").ToString()

frminfo.MailToState.Text = myDV(rowIndex)("MAIL_ST").ToString()

frminfo.MailToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.ShipToName.Text = myDV(rowIndex)("STORE").ToString()

frminfo.ShipToAdd1.Text = myDV(rowIndex)("SHIP_ADDRESS1").ToString()

frminfo.ShipToAdd2.Text = myDV(rowIndex)("SHIP_ADDRESS2").ToString()

frminfo.ShipToCity.Text = myDV(rowIndex)("SHIP_CITY").ToString()

frminfo.ShipToCounty.Text = myDV(rowIndex)("COUNTY").ToString()

frminfo.ShipToState.Text = myDV(rowIndex)("SHIP_ST").ToString()

frminfo.ShipToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.SupplierRepTop1.Text = myDV(rowIndex)("PAINT_TERRITORY_MANAGE_
NAME").ToString()

frminfo.SupplierRepTop2.Text = myDV(rowIndex)("REGIONAL_MANAGER").ToString()

frminfo.SupplierRepTop3.Text =
myDV(rowIndex)("RETAIL_BUSINES_MANAGER").ToString( )

frminfo.SupplierRepTop4.Text =
myDV(rowIndex)("RETAIL_DEVELOPMEN_MANAGER1").ToStr ing()

frminfo.SupplierRepTop5.Text = myDV(rowIndex)("RETAI_DEVELOPMENT_MANAGE
2").ToString()

Dim frminfo1 As New StoreInformation1

'Set up values for storeinform1 screen

frminfo1.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo1.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo1.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo1.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo1.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo1.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo1.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo1.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo1.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo1.ApprovalDate.Text = myDV(rowIndex)("APPROVAL_DATE").ToString()

frminfo1.Vision21Rank.Text = myDV(rowIndex)("VISION21_RANK").ToString()

frminfo1.NoBranches.Text = myDV(rowIndex)("NUMBER_BRANCHES").ToString()

frminfo1.ComputerType.Text = myDV(rowIndex)("COMPUTER_TYPE").ToString()

frminfo1.CYL.Text = myDV(rowIndex)("CYL").ToString()

frminfo1.TotBldgSF.Text = myDV(rowIndex)("TOTAL_BLDG_SF").ToString()

frminfo1.RetailHDWSF.Text = myDV(rowIndex)("RET_ HDW_SF").ToString()

frminfo1.PaintDeptSF.Text = myDV(rowIndex)("PNT_DEPT_SF").ToString()

frminfo1.PaintComputer.Text = myDV(rowIndex)("PAINT_COMPUTER").ToString()

frminfo1.PrattLambertOSO.Text =
myDV(rowIndex)("PRATT_LAMBERT_OSO_DATE").ToString( )

checkarea = myDV(rowIndex)("BEHR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("BEN_MOOR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("CALIF").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("COLONY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DEVOE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DUTCH_BOY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("FULLER_ O_BRIEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("GLIDDEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("LUCITE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("MARTIN_SENOUR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OLYMPIC").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OTHER_PAINT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PITTS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PORTERS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PPG").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PRATT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("RALPH_LAUREN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VALSPAR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VAN_SICKLE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Unchecked)

End If

frminfo.myDVR = myDV(rowIndex) 'or myDV.Item(rowIndex)

frminfo.Show()

End Sub

I know there is a lot of code here; hopefully someone understands what I'm
doing and I'm not wasting lots of efforts on something that could be done
easily.

From the most novice VB.NET 2003 (maybe 5 weeks self taught).

THanks,

Steve

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uc**************@TK2MSFTNGP05.phx.gbl...
Stephen,

You have given a lot of information and still it is not easy to help you.
Therefore some explanations.

A datarowview is a view on a datarow not to real datarow. You can get it
by
Datarowview.row

If you do an update than you can do using the DataAdapter a datarow, there
is nothing wrong with.

If you need more information, because we are here very basic.
- did you generate the dataadapter (and with that the update commands)
- what controls did you use
- did you use databinding

I hope this helps sofar,

Cor

"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:n5******************************@giganews.com ...
I'm very new to VB.NET 2003

Here is what I have accomplished:

MainSelectForm - Selects an item

In a public class I pass a DataViewRow to

ItemInformation1 Form
ItemInformation2 Form
.
.
ItemInformation7 Form

I am able to get from the DataViewRow
I am able to put data back into the DataViewRow
As I go Forward and Backwards between the ItemInformationForm[1-7] all
the data I change is available and working

I feel pretty good about my first attempt to VB.NET

Now what I want to do:

Setup a button on all ItemInformation[1-7] Forms to do an update
In the public class setup a variable that I can change when clicking on
the Update button to denote an update is needed

From within MainSelectForm do the update from the DataViewRow in the
public class

My questions are:

1. How do I check the Update Flag? (I've migrated from COBOL where I
would be able to check the update flag in a linkage section, I do not
know how to do this in OO because I do not have control)
2. IS the a way to do an SQL Update via the DataViewRow without having to
do the Update listing all the fields and the WHERE clause, I have over
100 fields?
3. I should be able to click an Update button from within any Form and
close Form after Form until getting back to MainSelectForm where the
Update would occur

Any assistance would be greatly apprecited,
Thanks,


Jun 19 '06 #3
Stephen,

It is really to much code to investigate in a newsgroup.

If it is so much than it is better to make a simple sample and try that
yourself first, that is easier to communicate about.

However, if I look to this code, than I get the idea that you try to enter
data using the datagrid.
That is the last thing you should do.

On our website are many samples about the use of the datagrid. Have a look
at some of those, I have selected one for you.

Be aware that if you want to use seperated textboxes or whatever, than you
can use databinding to those controls. The bindingmanager takes than care
that you select the same row in the datagrid as the information in your
textboxes.

http://www.vb-tips.com/default.aspx?...f-587f730fa118

I hope that this is a start.

Cor
"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:ss******************************@giganews.com ...
Thanks for the help!

I use two data adapters; the first is used to great the data grid. After a
record is selected via the DataGrid or a lookup field and button to
execute the value in the field and find the record from a second data
adapter that was greated with a "SELECT *".

Onve I find the DataViewRow within the second data adapter I pass it in
the Public class to all the forms. I can get data to and get back into the
dataviewrow without any incident. I'm assuming that at any point in any of
the screens I could do the update from the DataViewRow (I'd have no idea
how to do this). My goes would be that an "Update" button would reside on
each form and if the users clicks the Update button an UpdateFlag in the
Public CLass would be set.

At that point I want to check the Update Flag and keep going backwards
until I get to the main form and perform an update using the values in the
DataViewRow.

I than stay in the main form and the user can select another item and go
from there.

Steve
Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1
as ADDRESS, SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE"

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

myFormLibrary.StoreInformation1 = Me

myFormLibrary.StoreInformation2 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation5 = Me

myFormLibrary.StoreInformation6 = Me

myFormLibrary.StoreInformation7 = Me

PopulateStoreGrid()

'

' Create a Grid Table Style. Map it to the "Customers" Table.

'

Dim aGridTableStyle As New DataGridTableStyle

aGridTableStyle.MappingName = "BENMOOR1"

'

' Create GridColumnStyle objects for the grid columns

'

Dim aCol1 As New DataGridTextBoxColumn

Dim aCol2 As New DataGridTextBoxColumn

Dim aCol3 As New DataGridTextBoxColumn

Dim aCol4 As New DataGridTextBoxColumn

Dim aCol5 As New DataGridTextBoxColumn

Dim aCol6 As New DataGridTextBoxColumn

'

With aCol1

.HeaderText = "BM#"

.MappingName = "BM_NUMBER"

.Width = 45

.TextBox.Enabled = False

End With

'

' Set column 2's caption, width and disable editing.

'

With aCol2

.MappingName = "STORE_NUMBER"

.HeaderText = "Store#"

.Width = 40

.Alignment = HorizontalAlignment.Left

.TextBox.Enabled = False

End With

With aCol3

.MappingName = "STORE"

.HeaderText = "Store Name"

.Width = 200

.Alignment = HorizontalAlignment.Left

' .NullText = ""

.TextBox.Enabled = False

End With

With aCol4

.MappingName = "ADDRESS"

.HeaderText = "Store Address"

.Width = 200

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol5

.MappingName = "CITY"

.HeaderText = "CIty"

.Width = 100

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol6

.MappingName = "STATE"

.HeaderText = "St."

.Width = 30

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

'

' Add the GridColumnStyles to the DataGrid's Column Styles collection.

'

With aGridTableStyle.GridColumnStyles

.Add(aCol1)

.Add(aCol2)

.Add(aCol3)

.Add(aCol4)

.Add(aCol5)

.Add(aCol6)

End With

'

' Add the GridColumnStyles to the aGridTableStyle.

'

DataGrid1.TableStyles.Add(aGridTableStyle)

End Sub

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.DoubleClick

Dim StoreNo1 As String

Dim Storeno2 As String

Dim checkarea As String

Dim irow As Integer = DataGrid1.CurrentCell.RowNumber

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Dim frminfo As New StoreInformation

'Set up values for storeinfor screen

frminfo.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo.MailToName.Text = myDV(rowIndex)("MAIL_NAME").ToString()

frminfo.MailToAdd1.Text = myDV(rowIndex)("MAIL_ADDRESS1").ToString()

frminfo.MailToAdd2.Text = myDV(rowIndex)("MAIL_ADDRESS2").ToString()

frminfo.MailToCity.Text = myDV(rowIndex)("MAIL_CITY").ToString()

frminfo.MailToState.Text = myDV(rowIndex)("MAIL_ST").ToString()

frminfo.MailToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.ShipToName.Text = myDV(rowIndex)("STORE").ToString()

frminfo.ShipToAdd1.Text = myDV(rowIndex)("SHIP_ADDRESS1").ToString()

frminfo.ShipToAdd2.Text = myDV(rowIndex)("SHIP_ADDRESS2").ToString()

frminfo.ShipToCity.Text = myDV(rowIndex)("SHIP_CITY").ToString()

frminfo.ShipToCounty.Text = myDV(rowIndex)("COUNTY").ToString()

frminfo.ShipToState.Text = myDV(rowIndex)("SHIP_ST").ToString()

frminfo.ShipToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.SupplierRepTop1.Text = myDV(rowIndex)("PAINT_TERRITORY_MANAGE_
NAME").ToString()

frminfo.SupplierRepTop2.Text =
myDV(rowIndex)("REGIONAL_MANAGER").ToString()

frminfo.SupplierRepTop3.Text =
myDV(rowIndex)("RETAIL_BUSINES_MANAGER").ToString( )

frminfo.SupplierRepTop4.Text =
myDV(rowIndex)("RETAIL_DEVELOPMEN_MANAGER1").ToStr ing()

frminfo.SupplierRepTop5.Text = myDV(rowIndex)("RETAI_DEVELOPMENT_MANAGE
2").ToString()

Dim frminfo1 As New StoreInformation1

'Set up values for storeinform1 screen

frminfo1.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo1.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo1.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo1.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo1.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo1.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo1.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo1.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo1.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo1.ApprovalDate.Text = myDV(rowIndex)("APPROVAL_DATE").ToString()

frminfo1.Vision21Rank.Text = myDV(rowIndex)("VISION21_RANK").ToString()

frminfo1.NoBranches.Text = myDV(rowIndex)("NUMBER_BRANCHES").ToString()

frminfo1.ComputerType.Text = myDV(rowIndex)("COMPUTER_TYPE").ToString()

frminfo1.CYL.Text = myDV(rowIndex)("CYL").ToString()

frminfo1.TotBldgSF.Text = myDV(rowIndex)("TOTAL_BLDG_SF").ToString()

frminfo1.RetailHDWSF.Text = myDV(rowIndex)("RET_ HDW_SF").ToString()

frminfo1.PaintDeptSF.Text = myDV(rowIndex)("PNT_DEPT_SF").ToString()

frminfo1.PaintComputer.Text = myDV(rowIndex)("PAINT_COMPUTER").ToString()

frminfo1.PrattLambertOSO.Text =
myDV(rowIndex)("PRATT_LAMBERT_OSO_DATE").ToString( )

checkarea = myDV(rowIndex)("BEHR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("BEN_MOOR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("CALIF").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("COLONY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DEVOE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DUTCH_BOY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("FULLER_ O_BRIEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("GLIDDEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("LUCITE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("MARTIN_SENOUR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OLYMPIC").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OTHER_PAINT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PITTS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PORTERS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PPG").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PRATT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("RALPH_LAUREN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VALSPAR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VAN_SICKLE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Unchecked)

End If

frminfo.myDVR = myDV(rowIndex) 'or myDV.Item(rowIndex)

frminfo.Show()

End Sub

I know there is a lot of code here; hopefully someone understands what I'm
doing and I'm not wasting lots of efforts on something that could be done
easily.

From the most novice VB.NET 2003 (maybe 5 weeks self taught).

THanks,

Steve

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uc**************@TK2MSFTNGP05.phx.gbl...
Stephen,

You have given a lot of information and still it is not easy to help you.
Therefore some explanations.

A datarowview is a view on a datarow not to real datarow. You can get it
by
Datarowview.row

If you do an update than you can do using the DataAdapter a datarow,
there is nothing wrong with.

If you need more information, because we are here very basic.
- did you generate the dataadapter (and with that the update commands)
- what controls did you use
- did you use databinding

I hope this helps sofar,

Cor

"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:n5******************************@giganews.com ...
I'm very new to VB.NET 2003

Here is what I have accomplished:

MainSelectForm - Selects an item

In a public class I pass a DataViewRow to

ItemInformation1 Form
ItemInformation2 Form
.
.
ItemInformation7 Form

I am able to get from the DataViewRow
I am able to put data back into the DataViewRow
As I go Forward and Backwards between the ItemInformationForm[1-7] all
the data I change is available and working

I feel pretty good about my first attempt to VB.NET

Now what I want to do:

Setup a button on all ItemInformation[1-7] Forms to do an update
In the public class setup a variable that I can change when clicking on
the Update button to denote an update is needed

From within MainSelectForm do the update from the DataViewRow in the
public class

My questions are:

1. How do I check the Update Flag? (I've migrated from COBOL where I
would be able to check the update flag in a linkage section, I do not
know how to do this in OO because I do not have control)
2. IS the a way to do an SQL Update via the DataViewRow without having
to do the Update listing all the fields and the WHERE clause, I have
over 100 fields?
3. I should be able to click an Update button from within any Form and
close Form after Form until getting back to MainSelectForm where the
Update would occur

Any assistance would be greatly apprecited,
Thanks,



Jun 19 '06 #4
I think I have eerything worked out except one thing.

I can get fields out of and back into the DataViewRow variable I created in
a Public class.

When I need to do an SQL UPDATE can I use the DataViewRow directly or do I
need to do an SQL UPDATE using fld1, fld2, fld3, ....fld100 USING ITEMNO.

Steve
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oa**************@TK2MSFTNGP03.phx.gbl...
Stephen,

It is really to much code to investigate in a newsgroup.

If it is so much than it is better to make a simple sample and try that
yourself first, that is easier to communicate about.

However, if I look to this code, than I get the idea that you try to enter
data using the datagrid.
That is the last thing you should do.

On our website are many samples about the use of the datagrid. Have a look
at some of those, I have selected one for you.

Be aware that if you want to use seperated textboxes or whatever, than you
can use databinding to those controls. The bindingmanager takes than care
that you select the same row in the datagrid as the information in your
textboxes.

http://www.vb-tips.com/default.aspx?...f-587f730fa118

I hope that this is a start.

Cor
"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:ss******************************@giganews.com ...
Thanks for the help!

I use two data adapters; the first is used to great the data grid. After
a record is selected via the DataGrid or a lookup field and button to
execute the value in the field and find the record from a second data
adapter that was greated with a "SELECT *".

Onve I find the DataViewRow within the second data adapter I pass it in
the Public class to all the forms. I can get data to and get back into
the dataviewrow without any incident. I'm assuming that at any point in
any of the screens I could do the update from the DataViewRow (I'd have
no idea how to do this). My goes would be that an "Update" button would
reside on each form and if the users clicks the Update button an
UpdateFlag in the Public CLass would be set.

At that point I want to check the Update Flag and keep going backwards
until I get to the main form and perform an update using the values in
the DataViewRow.

I than stay in the main form and the user can select another item and go
from there.

Steve
Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String = "select BM_NUMBER, STORE_NUMBER, STORE,
SHIP_ADDRESS1 as ADDRESS, SHIP_CITY as CITY, SHIP_ST as STATE from
BENMOORETABLE"

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

myFormLibrary.StoreInformation1 = Me

myFormLibrary.StoreInformation2 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation5 = Me

myFormLibrary.StoreInformation6 = Me

myFormLibrary.StoreInformation7 = Me

PopulateStoreGrid()

'

' Create a Grid Table Style. Map it to the "Customers" Table.

'

Dim aGridTableStyle As New DataGridTableStyle

aGridTableStyle.MappingName = "BENMOOR1"

'

' Create GridColumnStyle objects for the grid columns

'

Dim aCol1 As New DataGridTextBoxColumn

Dim aCol2 As New DataGridTextBoxColumn

Dim aCol3 As New DataGridTextBoxColumn

Dim aCol4 As New DataGridTextBoxColumn

Dim aCol5 As New DataGridTextBoxColumn

Dim aCol6 As New DataGridTextBoxColumn

'

With aCol1

.HeaderText = "BM#"

.MappingName = "BM_NUMBER"

.Width = 45

.TextBox.Enabled = False

End With

'

' Set column 2's caption, width and disable editing.

'

With aCol2

.MappingName = "STORE_NUMBER"

.HeaderText = "Store#"

.Width = 40

.Alignment = HorizontalAlignment.Left

.TextBox.Enabled = False

End With

With aCol3

.MappingName = "STORE"

.HeaderText = "Store Name"

.Width = 200

.Alignment = HorizontalAlignment.Left

' .NullText = ""

.TextBox.Enabled = False

End With

With aCol4

.MappingName = "ADDRESS"

.HeaderText = "Store Address"

.Width = 200

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol5

.MappingName = "CITY"

.HeaderText = "CIty"

.Width = 100

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol6

.MappingName = "STATE"

.HeaderText = "St."

.Width = 30

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

'

' Add the GridColumnStyles to the DataGrid's Column Styles collection.

'

With aGridTableStyle.GridColumnStyles

.Add(aCol1)

.Add(aCol2)

.Add(aCol3)

.Add(aCol4)

.Add(aCol5)

.Add(aCol6)

End With

'

' Add the GridColumnStyles to the aGridTableStyle.

'

DataGrid1.TableStyles.Add(aGridTableStyle)

End Sub

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.DoubleClick

Dim StoreNo1 As String

Dim Storeno2 As String

Dim checkarea As String

Dim irow As Integer = DataGrid1.CurrentCell.RowNumber

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Dim frminfo As New StoreInformation

'Set up values for storeinfor screen

frminfo.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo.MailToName.Text = myDV(rowIndex)("MAIL_NAME").ToString()

frminfo.MailToAdd1.Text = myDV(rowIndex)("MAIL_ADDRESS1").ToString()

frminfo.MailToAdd2.Text = myDV(rowIndex)("MAIL_ADDRESS2").ToString()

frminfo.MailToCity.Text = myDV(rowIndex)("MAIL_CITY").ToString()

frminfo.MailToState.Text = myDV(rowIndex)("MAIL_ST").ToString()

frminfo.MailToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.ShipToName.Text = myDV(rowIndex)("STORE").ToString()

frminfo.ShipToAdd1.Text = myDV(rowIndex)("SHIP_ADDRESS1").ToString()

frminfo.ShipToAdd2.Text = myDV(rowIndex)("SHIP_ADDRESS2").ToString()

frminfo.ShipToCity.Text = myDV(rowIndex)("SHIP_CITY").ToString()

frminfo.ShipToCounty.Text = myDV(rowIndex)("COUNTY").ToString()

frminfo.ShipToState.Text = myDV(rowIndex)("SHIP_ST").ToString()

frminfo.ShipToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.SupplierRepTop1.Text = myDV(rowIndex)("PAINT_TERRITORY_MANAGE_
NAME").ToString()

frminfo.SupplierRepTop2.Text =
myDV(rowIndex)("REGIONAL_MANAGER").ToString()

frminfo.SupplierRepTop3.Text =
myDV(rowIndex)("RETAIL_BUSINES_MANAGER").ToString( )

frminfo.SupplierRepTop4.Text =
myDV(rowIndex)("RETAIL_DEVELOPMEN_MANAGER1").ToStr ing()

frminfo.SupplierRepTop5.Text = myDV(rowIndex)("RETAI_DEVELOPMENT_MANAGE
2").ToString()

Dim frminfo1 As New StoreInformation1

'Set up values for storeinform1 screen

frminfo1.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo1.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo1.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo1.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo1.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo1.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo1.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo1.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo1.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo1.ApprovalDate.Text = myDV(rowIndex)("APPROVAL_DATE").ToString()

frminfo1.Vision21Rank.Text = myDV(rowIndex)("VISION21_RANK").ToString()

frminfo1.NoBranches.Text = myDV(rowIndex)("NUMBER_BRANCHES").ToString()

frminfo1.ComputerType.Text = myDV(rowIndex)("COMPUTER_TYPE").ToString()

frminfo1.CYL.Text = myDV(rowIndex)("CYL").ToString()

frminfo1.TotBldgSF.Text = myDV(rowIndex)("TOTAL_BLDG_SF").ToString()

frminfo1.RetailHDWSF.Text = myDV(rowIndex)("RET_ HDW_SF").ToString()

frminfo1.PaintDeptSF.Text = myDV(rowIndex)("PNT_DEPT_SF").ToString()

frminfo1.PaintComputer.Text = myDV(rowIndex)("PAINT_COMPUTER").ToString()

frminfo1.PrattLambertOSO.Text =
myDV(rowIndex)("PRATT_LAMBERT_OSO_DATE").ToString( )

checkarea = myDV(rowIndex)("BEHR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("BEN_MOOR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("CALIF").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("COLONY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DEVOE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DUTCH_BOY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("FULLER_ O_BRIEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("GLIDDEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("LUCITE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("MARTIN_SENOUR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OLYMPIC").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OTHER_PAINT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PITTS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PORTERS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PPG").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PRATT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("RALPH_LAUREN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VALSPAR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VAN_SICKLE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Unchecked)

End If

frminfo.myDVR = myDV(rowIndex) 'or myDV.Item(rowIndex)

frminfo.Show()

End Sub

I know there is a lot of code here; hopefully someone understands what
I'm doing and I'm not wasting lots of efforts on something that could be
done easily.

From the most novice VB.NET 2003 (maybe 5 weeks self taught).

THanks,

Steve

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uc**************@TK2MSFTNGP05.phx.gbl...
Stephen,

You have given a lot of information and still it is not easy to help
you. Therefore some explanations.

A datarowview is a view on a datarow not to real datarow. You can get it
by
Datarowview.row

If you do an update than you can do using the DataAdapter a datarow,
there is nothing wrong with.

If you need more information, because we are here very basic.
- did you generate the dataadapter (and with that the update
commands)
- what controls did you use
- did you use databinding

I hope this helps sofar,

Cor

"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:n5******************************@giganews.com ...
I'm very new to VB.NET 2003

Here is what I have accomplished:

MainSelectForm - Selects an item

In a public class I pass a DataViewRow to

ItemInformation1 Form
ItemInformation2 Form
.
.
ItemInformation7 Form

I am able to get from the DataViewRow
I am able to put data back into the DataViewRow
As I go Forward and Backwards between the ItemInformationForm[1-7] all
the data I change is available and working

I feel pretty good about my first attempt to VB.NET

Now what I want to do:

Setup a button on all ItemInformation[1-7] Forms to do an update
In the public class setup a variable that I can change when clicking on
the Update button to denote an update is needed

From within MainSelectForm do the update from the DataViewRow in the
public class

My questions are:

1. How do I check the Update Flag? (I've migrated from COBOL where I
would be able to check the update flag in a linkage section, I do not
know how to do this in OO because I do not have control)
2. IS the a way to do an SQL Update via the DataViewRow without having
to do the Update listing all the fields and the WHERE clause, I have
over 100 fields?
3. I should be able to click an Update button from within any Form and
close Form after Form until getting back to MainSelectForm where the
Update would occur

Any assistance would be greatly apprecited,
Thanks,



Jun 20 '06 #5
Steve,

You use in my idea your own method completely different from others. I am
afraid that you will see yourself in future, by instance that help in those
methods is impossible to give.

Sorry,

Cor

"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:2J******************************@giganews.com ...
I think I have eerything worked out except one thing.

I can get fields out of and back into the DataViewRow variable I created
in a Public class.

When I need to do an SQL UPDATE can I use the DataViewRow directly or do I
need to do an SQL UPDATE using fld1, fld2, fld3, ....fld100 USING ITEMNO.

Steve
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oa**************@TK2MSFTNGP03.phx.gbl...
Stephen,

It is really to much code to investigate in a newsgroup.

If it is so much than it is better to make a simple sample and try that
yourself first, that is easier to communicate about.

However, if I look to this code, than I get the idea that you try to
enter data using the datagrid.
That is the last thing you should do.

On our website are many samples about the use of the datagrid. Have a
look at some of those, I have selected one for you.

Be aware that if you want to use seperated textboxes or whatever, than
you can use databinding to those controls. The bindingmanager takes than
care that you select the same row in the datagrid as the information in
your textboxes.

http://www.vb-tips.com/default.aspx?...f-587f730fa118

I hope that this is a start.

Cor
"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:ss******************************@giganews.com ...
Thanks for the help!

I use two data adapters; the first is used to great the data grid. After
a record is selected via the DataGrid or a lookup field and button to
execute the value in the field and find the record from a second data
adapter that was greated with a "SELECT *".

Onve I find the DataViewRow within the second data adapter I pass it in
the Public class to all the forms. I can get data to and get back into
the dataviewrow without any incident. I'm assuming that at any point in
any of the screens I could do the update from the DataViewRow (I'd have
no idea how to do this). My goes would be that an "Update" button would
reside on each form and if the users clicks the Update button an
UpdateFlag in the Public CLass would be set.

At that point I want to check the Update Flag and keep going backwards
until I get to the main form and perform an update using the values in
the DataViewRow.

I than stay in the main form and the user can select another item and go
from there.

Steve
Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String = "select BM_NUMBER, STORE_NUMBER, STORE,
SHIP_ADDRESS1 as ADDRESS, SHIP_CITY as CITY, SHIP_ST as STATE from
BENMOORETABLE"

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

myFormLibrary.StoreInformation1 = Me

myFormLibrary.StoreInformation2 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation4 = Me

myFormLibrary.StoreInformation5 = Me

myFormLibrary.StoreInformation6 = Me

myFormLibrary.StoreInformation7 = Me

PopulateStoreGrid()

'

' Create a Grid Table Style. Map it to the "Customers" Table.

'

Dim aGridTableStyle As New DataGridTableStyle

aGridTableStyle.MappingName = "BENMOOR1"

'

' Create GridColumnStyle objects for the grid columns

'

Dim aCol1 As New DataGridTextBoxColumn

Dim aCol2 As New DataGridTextBoxColumn

Dim aCol3 As New DataGridTextBoxColumn

Dim aCol4 As New DataGridTextBoxColumn

Dim aCol5 As New DataGridTextBoxColumn

Dim aCol6 As New DataGridTextBoxColumn

'

With aCol1

.HeaderText = "BM#"

.MappingName = "BM_NUMBER"

.Width = 45

.TextBox.Enabled = False

End With

'

' Set column 2's caption, width and disable editing.

'

With aCol2

.MappingName = "STORE_NUMBER"

.HeaderText = "Store#"

.Width = 40

.Alignment = HorizontalAlignment.Left

.TextBox.Enabled = False

End With

With aCol3

.MappingName = "STORE"

.HeaderText = "Store Name"

.Width = 200

.Alignment = HorizontalAlignment.Left

' .NullText = ""

.TextBox.Enabled = False

End With

With aCol4

.MappingName = "ADDRESS"

.HeaderText = "Store Address"

.Width = 200

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol5

.MappingName = "CITY"

.HeaderText = "CIty"

.Width = 100

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

With aCol6

.MappingName = "STATE"

.HeaderText = "St."

.Width = 30

.Alignment = HorizontalAlignment.Left

'.NullText = "0"

.TextBox.Enabled = False

'.Format = "#0.00"

End With

'

' Add the GridColumnStyles to the DataGrid's Column Styles collection.

'

With aGridTableStyle.GridColumnStyles

.Add(aCol1)

.Add(aCol2)

.Add(aCol3)

.Add(aCol4)

.Add(aCol5)

.Add(aCol6)

End With

'

' Add the GridColumnStyles to the aGridTableStyle.

'

DataGrid1.TableStyles.Add(aGridTableStyle)

End Sub

Private Sub DataGrid1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.DoubleClick

Dim StoreNo1 As String

Dim Storeno2 As String

Dim checkarea As String

Dim irow As Integer = DataGrid1.CurrentCell.RowNumber

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Dim frminfo As New StoreInformation

'Set up values for storeinfor screen

frminfo.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo.MailToName.Text = myDV(rowIndex)("MAIL_NAME").ToString()

frminfo.MailToAdd1.Text = myDV(rowIndex)("MAIL_ADDRESS1").ToString()

frminfo.MailToAdd2.Text = myDV(rowIndex)("MAIL_ADDRESS2").ToString()

frminfo.MailToCity.Text = myDV(rowIndex)("MAIL_CITY").ToString()

frminfo.MailToState.Text = myDV(rowIndex)("MAIL_ST").ToString()

frminfo.MailToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.ShipToName.Text = myDV(rowIndex)("STORE").ToString()

frminfo.ShipToAdd1.Text = myDV(rowIndex)("SHIP_ADDRESS1").ToString()

frminfo.ShipToAdd2.Text = myDV(rowIndex)("SHIP_ADDRESS2").ToString()

frminfo.ShipToCity.Text = myDV(rowIndex)("SHIP_CITY").ToString()

frminfo.ShipToCounty.Text = myDV(rowIndex)("COUNTY").ToString()

frminfo.ShipToState.Text = myDV(rowIndex)("SHIP_ST").ToString()

frminfo.ShipToZip.Text = myDV(rowIndex)("MAIL_ZIPCODE").ToString()

frminfo.SupplierRepTop1.Text = myDV(rowIndex)("PAINT_TERRITORY_MANAGE_
NAME").ToString()

frminfo.SupplierRepTop2.Text =
myDV(rowIndex)("REGIONAL_MANAGER").ToString()

frminfo.SupplierRepTop3.Text =
myDV(rowIndex)("RETAIL_BUSINES_MANAGER").ToString( )

frminfo.SupplierRepTop4.Text =
myDV(rowIndex)("RETAIL_DEVELOPMEN_MANAGER1").ToStr ing()

frminfo.SupplierRepTop5.Text = myDV(rowIndex)("RETAI_DEVELOPMENT_MANAGE
2").ToString()

Dim frminfo1 As New StoreInformation1

'Set up values for storeinform1 screen

frminfo1.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

frminfo1.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

frminfo1.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

frminfo1.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

frminfo1.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

frminfo1.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

frminfo1.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

StoreNo1 = myDV(rowIndex)("STORE_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("PARENT_STORE_NUMBER").ToString()

frminfo1.StoreNo.Text = StoreNo1 & " / " & Storeno2

StoreNo1 = myDV(rowIndex)("BM_NUMBER").ToString()

Storeno2 = myDV(rowIndex)("CURR").ToString()

frminfo1.BMNUMBER.Text = StoreNo1 & " / " & Storeno2

frminfo1.ApprovalDate.Text = myDV(rowIndex)("APPROVAL_DATE").ToString()

frminfo1.Vision21Rank.Text = myDV(rowIndex)("VISION21_RANK").ToString()

frminfo1.NoBranches.Text = myDV(rowIndex)("NUMBER_BRANCHES").ToString()

frminfo1.ComputerType.Text = myDV(rowIndex)("COMPUTER_TYPE").ToString()

frminfo1.CYL.Text = myDV(rowIndex)("CYL").ToString()

frminfo1.TotBldgSF.Text = myDV(rowIndex)("TOTAL_BLDG_SF").ToString()

frminfo1.RetailHDWSF.Text = myDV(rowIndex)("RET_ HDW_SF").ToString()

frminfo1.PaintDeptSF.Text = myDV(rowIndex)("PNT_DEPT_SF").ToString()

frminfo1.PaintComputer.Text =
myDV(rowIndex)("PAINT_COMPUTER").ToString()

frminfo1.PrattLambertOSO.Text =
myDV(rowIndex)("PRATT_LAMBERT_OSO_DATE").ToString( )

checkarea = myDV(rowIndex)("BEHR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(0, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("BEN_MOOR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(1, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("CALIF").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(2, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("COLONY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(3, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DEVOE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(4, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("DUTCH_BOY").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(5, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("FULLER_ O_BRIEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(6, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("GLIDDEN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(7, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("LUCITE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(8, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("MARTIN_SENOUR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(9, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OLYMPIC").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(10, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("OTHER_PAINT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(11, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PITTS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(12, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PORTERS").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(13, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PPG").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(14, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("PRATT").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(15, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("RALPH_LAUREN").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(16, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VALSPAR").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(17, CheckState.Unchecked)

End If

checkarea = myDV(rowIndex)("VAN_SICKLE").ToString()

If checkarea = "Y" Then

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Checked)

Else

frminfo1.CheckedListBox1.SetItemCheckState(18, CheckState.Unchecked)

End If

frminfo.myDVR = myDV(rowIndex) 'or myDV.Item(rowIndex)

frminfo.Show()

End Sub

I know there is a lot of code here; hopefully someone understands what
I'm doing and I'm not wasting lots of efforts on something that could be
done easily.

From the most novice VB.NET 2003 (maybe 5 weeks self taught).

THanks,

Steve

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uc**************@TK2MSFTNGP05.phx.gbl...
Stephen,

You have given a lot of information and still it is not easy to help
you. Therefore some explanations.

A datarowview is a view on a datarow not to real datarow. You can get
it by
Datarowview.row

If you do an update than you can do using the DataAdapter a datarow,
there is nothing wrong with.

If you need more information, because we are here very basic.
- did you generate the dataadapter (and with that the update
commands)
- what controls did you use
- did you use databinding

I hope this helps sofar,

Cor

"Stephen Plotnick" <sp*******@groupcbf.com> schreef in bericht
news:n5******************************@giganews.com ...
> I'm very new to VB.NET 2003
>
> Here is what I have accomplished:
>
> MainSelectForm - Selects an item
>
> In a public class I pass a DataViewRow to
>
> ItemInformation1 Form
> ItemInformation2 Form
> .
> .
> ItemInformation7 Form
>
> I am able to get from the DataViewRow
> I am able to put data back into the DataViewRow
> As I go Forward and Backwards between the ItemInformationForm[1-7] all
> the data I change is available and working
>
> I feel pretty good about my first attempt to VB.NET
>
> Now what I want to do:
>
> Setup a button on all ItemInformation[1-7] Forms to do an update
> In the public class setup a variable that I can change when clicking
> on the Update button to denote an update is needed
>
> From within MainSelectForm do the update from the DataViewRow in the
> public class
>
> My questions are:
>
> 1. How do I check the Update Flag? (I've migrated from COBOL where I
> would be able to check the update flag in a linkage section, I do not
> know how to do this in OO because I do not have control)
> 2. IS the a way to do an SQL Update via the DataViewRow without having
> to do the Update listing all the fields and the WHERE clause, I have
> over 100 fields?
> 3. I should be able to click an Update button from within any Form and
> close Form after Form until getting back to MainSelectForm where the
> Update would occur
>
> Any assistance would be greatly apprecited,
> Thanks,
>



Jun 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
27
by: VK | last post by:
<http://www.jibbering.com/faq/#FAQ3_2> The parts where update, replacement or add-on is needed are in <update> tag. 3.2 What online resources are available? Javascript FAQ sites, please...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
1
by: Bill | last post by:
This test is generating a compile error: private void BuildFTPRec(DataRowView a, DataRowView h) { foreach (DataRow r in a) { foreach (DataColumn dc in r) { Console.WriteLine(r.ToString()); }
2
by: Johann Blake | last post by:
When adding a new row to a DataView, is it possible to cast the returned DataViewRow to a typed row? Without casting, I am forced to indicate the names of fields as strings when setting their...
1
by: John Chorlton | last post by:
I've been attempting to pass a chunk of data back from a child Windows form using public properties on the form and have been getting some odd errors. I wanted to return a row of data to avoid...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.