Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 30th, 2008, 04:10 PM
Registered User
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default strongly-typed DataSet.Rows r n't getting Updated

Hi All,

I am using Gridview's Edit functionality by enabling AutoGenerateEditButton="true" .I am able to Edit,but the values aren't getting Updated.Even it's not giving exception.

Regards
Sri


 
Old October 1st, 2008, 05:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You have posted this in a Professional ASP.NET forum. Posting in a Pro forum comes with a few responsibilities, including:

1. Somehow show you've done some research into the problem yourself. Tell us / show us how you looked at the problem, what you've done to diagnose, what Google brought or didn't bring up and so on.

2. Provide a clear problem description.

3. Show us code, or tell us more about the setup of your application, the database you're using and so on.

This is no hand holding forum, and also no game of hide and see where you hide the problem and we try to seek it... ;)

So, please reformulate your question and we'll be able to help out.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old October 1st, 2008, 09:33 AM
Registered User
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

   This application was developed by another developer,i joined recently am only the resource,am fixing the update problem in the screen.Pasted Code,I am unable to send all of it,suggest an alternative.
   using Gridview's Edit by enabling AutoGenerateEditButton="true" .It's is Editable,but the values aren't getting Updated.
Db is SQL Server 2005 and VS 2005.

   Table:- BAC_GI_DB70_Institution

Columns:- Institution(varchar(100),not null) , Loc_City_Org(int,not null),
GB1(bit,can b nulls),GB2(bit,can b nulls),GB3(bit,can b nulls),GB4(bit,can b nulls),GB5(bit,can b nulls),GB6(bit,can b nulls),Allt_Cde(varchar(6),not null),Loc_County_Org_ID(int,not null)

Primary Key:- Institution,Allt_Cde,Loc_County_Org_ID

DB70Institution.aspx

<asp:GridView ID="gvDB70Institution" runat="server" AutoGenerateColumns="False" DataKeyNames="Institution,Allt_Cde,Loc_County_Org_ ID"
                            DataSourceID="ObjectDataSource1" AutoGenerateEditButton="true">
                            <Columns>
                                <%--<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />--%>
                                <%--<asp:BoundField DataField="Institution" HeaderText="Institution" SortExpression="Institution" >
                                    <ControlStyle Width="275px" />
                                    <HeaderStyle Width="275px" />
                                    <ItemStyle Width="275px" />
                                </asp:BoundField>--%>
                                <asp:TemplateField>
                                 <ItemTemplate>
                                  <asp:LinkButton ID="LnkDelete" Runat="server" OnClientClick="return confirm('Are you sure you want to delete this record?');" CommandName="Delete">Delete</asp:LinkButton>
                                 </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Institution" SortExpression="Institution" >
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtInstitution" runat="server" Text='<%# Bind("Institution") %>' Width="250px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblInstitution" runat="server" Text='<%# Bind("Institution") %>' Width="250px"></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="City" SortExpression="Loc_City_Org_ID" >
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="ddlUpdateCity" runat="server" Width="150px" DataTextField="org_name" DataSource="<%# LoadListCity() %>" SelectedIndex='<%# Bind("Loc_City_Org_ID") %>'></asp:DropDownList>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblUpdateCity" runat="server" Text='<%# Bind("City") %>' Width="150px" ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CheckBoxField DataField="GB1" HeaderText="GB1" SortExpression="GB1" />
                                <asp:CheckBoxField DataField="GB2" HeaderText="GB2" SortExpression="GB2" />
                                <asp:CheckBoxField DataField="GB3" HeaderText="GB3" SortExpression="GB3" />
                                <asp:CheckBoxField DataField="GB4" HeaderText="GB4" SortExpression="GB4" />
                                <asp:CheckBoxField DataField="GB5" HeaderText="GB5" SortExpression="GB5" />
                                <asp:CheckBoxField DataField="GB6" HeaderText="GB6" SortExpression="GB6" />
                                <%--<asp:ButtonField CommandName="Update" Text="Edit" />


                                <asp:ButtonField CommandName="Delete" Text="Delete" /> Loc_City_Org_ID --%>
                            </Columns>
                        </asp:GridView>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteQuery"
                            InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
                            TypeName="DataAccessTier.dsGiDB70InstitutionTableA dapters.BAC_GI_DB70_InstitutionTableAdapter"
                            UpdateMethod="UpdateQuery">
                            <UpdateParameters>
                                <asp:Parameter Name="Allt_Cde" Type="String" />
                                <asp:Parameter Name="Loc_County_Org_ID" Type="Int32" />
                                <asp:Parameter Name="Institution" Type="String" />
                                <asp:Parameter Name="Loc_City_Org_ID" Type="Int32" />
                                <asp:Parameter Name="GB1" Type="Boolean" />
                                <asp:Parameter Name="GB2" Type="Boolean" />
                                <asp:Parameter Name="GB3" Type="Boolean" />
                                <asp:Parameter Name="GB4" Type="Boolean" />
                                <asp:Parameter Name="GB5" Type="Boolean" />
                                <asp:Parameter Name="GB6" Type="Boolean" />
                                <asp:Parameter Name="Original_Allt_Cde" Type="String" />
                                <asp:Parameter Name="Original_Loc_County_Org_ID" Type="Int32" />
                                <asp:Parameter Name="Original_Institution" Type="String" />
                                <asp:Parameter Name="Original_Loc_City_Org_ID" Type="Int32" />
                                <asp:Parameter Name="IsNull_GB1" Type="String" />
                                <asp:Parameter Name="Original_GB1" Type="Boolean" />
                                <asp:Parameter Name="IsNull_GB2" Type="String" />
                                <asp:Parameter Name="Original_GB2" Type="Boolean" />
                                <asp:Parameter Name="IsNull_GB3" Type="String" />
                                <asp:Parameter Name="Original_GB3" Type="Boolean" />
                                <asp:Parameter Name="IsNull_GB4" Type="String" />
                                <asp:Parameter Name="Original_GB4" Type="Boolean" />
                                <asp:Parameter Name="IsNull_GB5" Type="String" />
                                <asp:Parameter Name="Original_GB5" Type="Boolean" />
                                <asp:Parameter Name="IsNull_GB6" Type="String" />
                                <asp:Parameter Name="Original_GB6" Type="Boolean" />
                            </UpdateParameters>
                          </asp:ObjectDataSource>

dsGiDB70Institution.designer.vb

<Global.System.Diagnostics.DebuggerNonUserCodeAttr ibute(), _
         Global.System.ComponentModel.Design.HelpKeywordAtt ribute("vs.data.TableAdapter"), _
         Global.System.ComponentModel.DataObjectMethodAttri bute(Global.System.ComponentModel.DataObjectMethod Type.Update, false)> _
        Public Overloads Overridable Function UpdateQuery(ByVal Institution As String, ByVal Loc_City_Org_ID As Integer, ByVal GB1 As Global.System.Nullable(Of Boolean), ByVal GB2 As Global.System.Nullable(Of Boolean), ByVal GB3 As Global.System.Nullable(Of Boolean), ByVal GB4 As Global.System.Nullable(Of Boolean), ByVal GB5 As Global.System.Nullable(Of Boolean), ByVal GB6 As Global.System.Nullable(Of Boolean), ByVal Original_Allt_Cde As String, ByVal Original_Loc_County_Org_ID As Integer, ByVal Original_Institution As String) As Integer
            Dim command As Global.System.Data.SqlClient.SqlCommand = Me.CommandCollection(3)
            If (Institution Is Nothing) Then
                Throw New Global.System.ArgumentNullException("Institution")
            Else
                command.Parameters(0).Value = CType(Institution,String)
            End If
            command.Parameters(1).Value = CType(Loc_City_Org_ID,Integer)
            If (GB1.HasValue = true) Then
                command.Parameters(2).Value = CType(GB1.Value,Boolean)
            Else
                command.Parameters(2).Value = Global.System.DBNull.Value
            End If
            If (GB2.HasValue = true) Then
                command.Parameters(3).Value = CType(GB2.Value,Boolean)
            Else
                command.Parameters(3).Value = Global.System.DBNull.Value
            End If
            If (GB3.HasValue = true) Then
                command.Parameters(4).Value = CType(GB3.Value,Boolean)
            Else
                command.Parameters(4).Value = Global.System.DBNull.Value
            End If
            If (GB4.HasValue = true) Then
                command.Parameters(5).Value = CType(GB4.Value,Boolean)
            Else
                command.Parameters(5).Value = Global.System.DBNull.Value
            End If
            If (GB5.HasValue = true) Then
                command.Parameters(6).Value = CType(GB5.Value,Boolean)
            Else
                command.Parameters(6).Value = Global.System.DBNull.Value
            End If
            If (GB6.HasValue = true) Then
                command.Parameters(7).Value = CType(GB6.Value,Boolean)
            Else
                command.Parameters(7).Value = Global.System.DBNull.Value
            End If
            If (Original_Allt_Cde Is Nothing) Then
                Throw New Global.System.ArgumentNullException("Original_Allt _Cde")
            Else
                command.Parameters(8).Value = CType(Original_Allt_Cde,String)
            End If
            command.Parameters(9).Value = CType(Original_Loc_County_Org_ID,Integer)
            If (Original_Institution Is Nothing) Then
                Throw New Global.System.ArgumentNullException("Original_Inst itution")
            Else
                command.Parameters(10).Value = CType(Original_Institution,String)
            End If
            Dim previousConnectionState As Global.System.Data.ConnectionState = command.Connection.State
            If ((command.Connection.State And Global.System.Data.ConnectionState.Open) _
                        <> Global.System.Data.ConnectionState.Open) Then
                command.Connection.Open
            End If
            Dim returnValue As Integer
            Try
                returnValue = command.ExecuteNonQuery
            Finally
                If (previousConnectionState = Global.System.Data.ConnectionState.Closed) Then
                    command.Connection.Close
                End If
            End Try
            Return returnValue
        End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttr ibute()> _
        Private Sub InitCommandCollection()
            Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(3) {}

            Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "SELECT BAC_GI_DB70_Institution.Allt_Cde, BAC_GI_DB70_Institution.Loc_County_Org_I"& _
                "D, dbCounty.Org_name County, BAC_GI_DB70_Institution.Institution, BAC_GI_DB70_In"& _
                "stitution.Loc_City_Org_ID, dbCity.Org_name City, BAC_GI_DB70_Institution.GB1, BA"& _
                "C_GI_DB70_Institution.GB2, BAC_GI_DB70_Institution.GB3, BAC_GI_DB70_Institution."& _
                "GB4, BAC_GI_DB70_Institution.GB5, BAC_GI_DB70_Institution.GB6 FROM BAC_GI_DB70_I"& _
                "nstitution INNER JOIN Bac_Org AS dbCounty ON dbCounty.Org_ID = Loc_County_Org_ID"& _
                " INNER JOIN Bac_Org AS dbCity ON dbCity.Org_ID = Loc_City_Org_ID WHERE ((BAC_GI_"& _
                "DB70_Institution.Allt_Cde = @Allt_Cde) AND (BAC_GI_DB70_Institution.Loc_County_O"& _
                "rg_ID = @Loc_County_Org_ID))"
            Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Allt_C de", Global.System.Data.SqlDbType.VarChar, 6, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._commandCollection(0).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Loc_Co unty_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))

            Me._commandCollection(1) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(1).Connection = Me.Connection
            Me._commandCollection(1).CommandText = "DELETE FROM [BAC_GI_DB70_Institution] WHERE [Allt_Cde] = @Original_Allt_Cde AND [Institution] = @Original_Institution AND [Loc_County_Org_ID] = @Original_Loc_County_Org_ID"
            Me._commandCollection(1).CommandType = Global.System.Data.CommandType.Text
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Allt_Cde", Global.System.Data.SqlDbType.NVarChar, 6, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Institution", Global.System.Data.SqlDbType.NVarChar, 100, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(1).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Loc_County_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))

            Me._commandCollection(2) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(2).Connection = Me.Connection
            Me._commandCollection(2).CommandText = "SELECT BAC_GI_DB70_Institution.Allt_Cde, BAC_GI_DB70_Institution.Loc_County_Org_I" & _
                "D, dbCounty.Org_name County, BAC_GI_DB70_Institution.Institution, BAC_GI_DB70_In" & _
                "stitution.Loc_City_Org_ID, dbCity.Org_name City, BAC_GI_DB70_Institution.GB1, BA" & _
                "C_GI_DB70_Institution.GB2, BAC_GI_DB70_Institution.GB3, BAC_GI_DB70_Institution." & _
                "GB4, BAC_GI_DB70_Institution.GB5, BAC_GI_DB70_Institution.GB6 FROM BAC_GI_DB70_I" & _
                "nstitution INNER JOIN Bac_Org AS dbCounty ON dbCounty.Org_ID = Loc_County_Org_ID" & _
                " INNER JOIN Bac_Org AS dbCity ON dbCity.Org_ID = Loc_City_Org_ID WHERE ((BAC_GI_" & _
                "DB70_Institution.Allt_Cde = @Allt_Cde) AND (BAC_GI_DB70_Institution.Loc_County_O" & _
                "rg_ID = @Loc_County_Org_ID))"
            Me._commandCollection(2).CommandType = Global.System.Data.CommandType.Text
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Allt_C de", Global.System.Data.SqlDbType.VarChar, 6, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(2).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Loc_Co unty_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))

            Me._commandCollection(3) = New Global.System.Data.SqlClient.SqlCommand
            Me._commandCollection(3).Connection = Me.Connection
            Me._commandCollection(3).CommandText = " UPDATE [BAC_GI_DB70_Institution] SET [Institution] = @Institution, [Loc_City_Org" & _
                "_ID] = @Loc_City_Org_ID, [GB1] = @GB1, [GB2] = @GB2, [GB3] = @GB3, [GB4] = @GB4," & _
                " [GB5] = @GB5, [GB6] = @GB6 WHERE ([Allt_Cde] = @Original_Allt_Cde) AND ([Loc_Co" & _
                "unty_Org_ID] = @Original_Loc_County_Org_ID) AND ([Institution] = @Original_Insti" & _
                "tution) "
            Me._commandCollection(3).CommandType = Global.System.Data.CommandType.Text
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Instit ution", Global.System.Data.SqlDbType.NVarChar, 100, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Loc_Ci ty_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_City_Org_ID", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB1", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB1", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB2", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB2", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB3", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB3", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB4", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB4", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB5", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB5", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB6", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB6", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Allt_Cde", Global.System.Data.SqlDbType.NVarChar, 6, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Loc_County_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
            Me._commandCollection(3).Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Institution", Global.System.Data.SqlDbType.NVarChar, 100, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))
        End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttr ibute()> _
        Private Sub InitAdapter()
            Me._adapter = New Global.System.Data.SqlClient.SqlDataAdapter
            Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping
            tableMapping.SourceTable = "Table"
            tableMapping.DataSetTable = "BAC_GI_DB70_Institution"
            tableMapping.ColumnMappings.Add("Institution", "Institution")
            tableMapping.ColumnMappings.Add("Loc_City_Org_ID", "Loc_City_Org_ID")
            tableMapping.ColumnMappings.Add("City", "City")
            tableMapping.ColumnMappings.Add("GB1", "GB1")
            tableMapping.ColumnMappings.Add("GB2", "GB2")
            tableMapping.ColumnMappings.Add("GB3", "GB3")
            tableMapping.ColumnMappings.Add("GB4", "GB4")
            tableMapping.ColumnMappings.Add("GB5", "GB5")
            tableMapping.ColumnMappings.Add("GB6", "GB6")
            tableMapping.ColumnMappings.Add("Allt_Cde", "Allt_Cde")
            tableMapping.ColumnMappings.Add("Loc_County_Org_ID ", "Loc_County_Org_ID")
            tableMapping.ColumnMappings.Add("County", "County")
            Me._adapter.TableMappings.Add(tableMapping)
            Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.DeleteCommand.Connection = Me.Connection
            Me._adapter.DeleteCommand.CommandText = "DELETE FROM [BAC_GI_DB70_Institution] WHERE (([Allt_Cde] = @Original_Allt_Cde) AN"& _
                "D ([Loc_County_Org_ID] = @Original_Loc_County_Org_ID) AND ([Institution] = @Orig"& _
                "inal_Institution) AND ([Loc_City_Org_ID] = @Original_Loc_City_Org_ID) AND ((@IsN"& _
                "ull_GB1 = 1 AND [GB1] IS NULL) OR ([GB1] = @Original_GB1)) AND ((@IsNull_GB2 = 1"& _
                " AND [GB2] IS NULL) OR ([GB2] = @Original_GB2)) AND ((@IsNull_GB3 = 1 AND [GB3] "& _
                "IS NULL) OR ([GB3] = @Original_GB3)) AND ((@IsNull_GB4 = 1 AND [GB4] IS NULL) OR"& _
                " ([GB4] = @Original_GB4)) AND ((@IsNull_GB5 = 1 AND [GB5] IS NULL) OR ([GB5] = @"& _
                "Original_GB5)) AND ((@IsNull_GB6 = 1 AND [GB6] IS NULL) OR ([GB6] = @Original_GB"& _
                "6)))"
            Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Allt_Cde", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Loc_County_Org_ID", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Institution", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Loc_City_Org_ID", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_City_Org_ID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull _GB1", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB1", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_GB1", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB1", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull _GB2", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB2", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_GB2", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB2", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull _GB3", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB3", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_GB3", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB3", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull _GB4", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB4", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_GB4", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB4", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull _GB5", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB5", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_GB5", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB5", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull _GB6", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB6", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
            Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_GB6", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB6", Global.System.Data.DataRowVersion.Original, False, Nothing, "", "", ""))

            Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.InsertCommand.Connection = Me.Connection
            Me._adapter.InsertCommand.CommandText = "INSERT INTO [BAC_GI_DB70_Institution] ([Allt_Cde], [Loc_County_Org_ID], [Institut"& _
                "ion], [Loc_City_Org_ID], [GB1], [GB2], [GB3], [GB4], [GB5], [GB6]) VALUES (@Allt"& _
                "_Cde, @Loc_County_Org_ID, @Institution, @Loc_City_Org_ID, @GB1, @GB2, @GB3, @GB4"& _
                ", @GB5, @GB6);"&Global.Microsoft.VisualBasic.ChrW(13)&Glob al.Microsoft.VisualBasic.ChrW(10)&"SELECT Allt_Cde, Loc_County_Org_ID, Institution, Loc_City_Org_ID"& _
                ", GB1, GB2, GB3, GB4, GB5, GB6 FROM BAC_GI_DB70_Institution WHERE (Allt_Cde = @A"& _
                "llt_Cde) AND (Institution = @Institution) AND (Loc_County_Org_ID = @Loc_County_O"& _
                "rg_ID)"
            Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Allt_C de", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Loc_Co unty_Org_ID", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Instit ution", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Loc_Ci ty_Org_ID", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_City_Org_ID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB1", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB1", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB2", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB2", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB3", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB3", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB4", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB4", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB5", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB5", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB6", Global.System.Data.SqlDbType.Bit, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GB6", Global.System.Data.DataRowVersion.Current, False, Nothing, "", "", ""))

            Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
            Me._adapter.UpdateCommand.Connection = Me.Connection
            Me._adapter.UpdateCommand.CommandText = ""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Mi crosoft.VisualBasic.ChrW(10)&" UPDATE BAC_GI_DB70_Institution SET Institution = @Institu"& _
                "tion, Loc_City_Org_ID = @Loc_City_Org_ID, GB1 = @GB1, GB2 = @GB2, GB3 = @GB3, GB"& _
                "4 = @GB4, GB5 = @GB5,GB6 = @GB6 WHERE (Allt_Cde = @Original_Allt_Cde) AND (Loc_C"& _
                "ounty_Org_ID = @Original_Loc_County_Org_ID) AND (Institution = @Original_Institu"& _
                "tion) AND (Loc_City_Org_ID = @Original_Loc_City_Org_ID) AND (@IsNull_GB1 = 1 AND"& _
                " GB1 IS NULL OR GB1 = @Original_GB1) AND (@IsNull_GB2 = 1 AND GB2 IS NULL OR GB2"& _
                " = @Original_GB2) AND (@IsNull_GB3 = 1 AND GB3 IS NULL OR GB3 = @Original_GB3) A"& _
                "ND (@IsNull_GB4 = 1 AND GB4 IS NULL OR GB4 = @Original_GB4) AND (@IsNull_GB5 = 1"& _
                " AND GB5 IS NULL OR GB5 = @Original_GB5) AND (@IsNull_GB6 = 1 AND GB6 IS NULL OR"& _
                " GB6 = @Original_GB6);"&Global.Microsoft.VisualBasic.ChrW (13)&Global.Microsoft.VisualBasic.ChrW(10)&" SELECT Allt_Cde, Loc_County_Org_ID"& _
                ", Institution, Loc_City_Org_ID, GB1, GB2, GB3, GB4, GB5, GB6 FROM BAC_GI_DB70_In"& _
                "stitution WHERE (Allt_Cde = @Allt_Cde) AND (Institution = @Institution) AND (Loc"& _
                "_County_Org_ID = @Loc_County_Org_ID)"
            Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Instit ution", Global.System.Data.SqlDbType.NVarChar, 100, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Loc_Ci ty_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_City_Org_ID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB1", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB1", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB2", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB2", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB3", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB3", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB4", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB4", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB5", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB5", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GB6", Global.System.Data.SqlDbType.Bit, 1, Global.System.Data.ParameterDirection.Input, 0, 0, "GB6", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Allt_Cde", Global.System.Data.SqlDbType.VarChar, 6, Global.System.Data.ParameterDirection.Input, 0, 0, "Allt_Cde", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Loc_County_Org_ID", Global.System.Data.SqlDbType.Int, 4, Global.System.Data.ParameterDirection.Input, 0, 0, "Loc_County_Org_ID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
            Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Origin al_Institution", Global.System.Data.SqlDbType.VarChar, 100, Global.System.Data.ParameterDirection.Input, 0, 0, "Institution", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
 
Old October 1st, 2008, 05:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am sorry, but this is a bit too much code to digest here. Also, since it depends so much on a database I can't run it. So, it's pretty much impossible for me to suggest something useful on this, especially because there is so much, and messy, code.

Sorry.

Try minimizing the code and narrowing down the problem scope until it's clearer what is causing it.

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
"Strongly typed" roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 26th, 2008 10:35 AM
Sorting Gridview bound to strongly typed object kulkarnimonica ASP.NET 2.0 Professional 10 September 20th, 2007 03:32 PM
Record Locking & Transactions in Strongly Typed DS Kia Visual Basic 2005 Basics 4 July 23rd, 2007 06:23 AM
Accessing Strongly Typed Session Data Woodman ASP.NET 2.0 Professional 2 March 9th, 2007 04:42 PM
Crystal Report and Strongly-Typed dataset jaucourt Crystal Reports 1 February 9th, 2004 07:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.