Item has already been added. Key in dictionary: 'Cellular' Key being added: 'Cellular'


 Hi,

When inserting a new item i get the following error: Item has already been added. Key in dictionary: 'Cellular'  Key being added: 'Cellular'

As far as I know you get that error if you enter the parameter more than once, however i can't find anywhere in my code where the value is entered more than once. What could be the problem?

Thanks in advance for the help :-)

Details.aspx

<asp:objectdatasource id="ObjectDataSource1" runat="server" insertmethod="InsertMomDetails"

oninserted="Formview2_Inserted" oninserting="Numbers_Inserting" selectmethod="GetSingleMom"

typename="Classes">

<selectparameters>

<asp:sessionparameter name="mId" sessionfield="mid" type="String" />

</selectparameters>

<insertparameters>

<asp:parameter name="Id" type="Int32" />

<asp:parameter name="Mid" type="String" />

<asp:parameter name="FamilyName" type="String" />

<asp:parameter name="FirstName" type="String" />

<asp:parameter name="Flat" type="String" />

<asp:parameter name="House" type="String" />

<asp:parameter name="Street" type="String" />

<asp:parameter name="Mikud" type="String" />

<asp:parameter name="PartnerName" type="String" />

<asp:parameter name="Cityid" type="Int32" />

<asp:parameter name="TimesParticipated" type="Int32" />

<asp:parameter name="LastMenstrualDate" type="DateTime" />

<asp:parameter name="Birthdate" type="DateTime" />

<asp:parameter name="ScheduleDate" type="DateTime" />

<asp:parameter name="PregnancyWeek" type="Int32" />

</insertparameters>

</asp:objectdatasource>

Protected Sub Numbers_Inserting(ByVal sender As Object, ByVal e As ObjectDataSourceMethodEventArgs)

Dim Telephone As String

Dim Cellular As String

Dim cellPre As DropDownList = FormView2.FindControl("ddl_iCell")

Dim cPre As String = cellPre.SelectedValue

Dim cell As TextBox = FormView2.FindControl("i_Cellular")

Cellular = cPre &

"-" & cell.Text

Dim ddl_iPhone As DropDownList = FormView2.FindControl("ddl_iPhone")

Dim i_phone As TextBox = FormView2.FindControl("i_Telephone")

Telephone = ddl_iPhone.SelectedValue &

"-" & i_phone.Text

e.InputParameters.Add(

"Cellular", Cellular) -error line

e.InputParameters.Add(

"Telephone", Telephone)

End Sub

Classes.vb

 Public Function InsertMomDetails(ByVal Mid As String, _

ByVal FamilyName As String, _

ByVal FirstName As String, _

ByVal Flat As String, _

ByVal House As String, _

ByVal Street As String, _

ByVal Mikud As String, _

ByVal Telephone As String, _

ByVal Cellular As String, _

ByVal PartnerName As String, _

ByVal Cityid As Integer, _

ByVal TimesParticipated As Integer, _

ByVal LastMenstrualDate As DateTime, _

ByVal Birthdate As DateTime, _

ByVal ScheduleDate As DateTime, _

ByVal PregnancyWeek As Integer)

Dim myCommand As New SqlCommand("InsertMomDetails", myConnection)

myCommand.CommandType = CommandType.StoredProcedure

myCommand.Parameters.Add(New SqlParameter("@Id", SqlDbType.Int))

myCommand.Parameters("@Id").Direction = ParameterDirection.Output

myCommand.Parameters("@Id").SourceColumn = "Id"

myCommand.Parameters.AddWithValue(

"@Mid", Mid)

myCommand.Parameters.AddWithValue(

"@FamilyName", FamilyName)

myCommand.Parameters.AddWithValue(

"@FirstName", FirstName)

myCommand.Parameters.AddWithValue(

"@Flat", Flat)

myCommand.Parameters.AddWithValue(

"@House", House)

myCommand.Parameters.AddWithValue(

"@Street", Street)

myCommand.Parameters.AddWithValue(

"@Mikud", Mikud)

myCommand.Parameters.AddWithValue(

"@Telephone", Telephone)

myCommand.Parameters.AddWithValue(

"@Cellular", Cellular)

myCommand.Parameters.AddWithValue(

"@PartnerName", PartnerName)

myCommand.Parameters.AddWithValue(

"@Cityid", Cityid)

myCommand.Parameters.AddWithValue(

"@TimesParticipated", TimesParticipated)

myCommand.Parameters.AddWithValue(

"@LastMenstrualDate", LastMenstrualDate)

myCommand.Parameters.AddWithValue(

"@Birthdate", Birthdate)

myCommand.Parameters.AddWithValue(

"@Scheduledate", ScheduleDate)

myCommand.Parameters.AddWithValue(

"@PregnancyWeek", PregnancyWeek)

myConnection.Open()

Dim affectedRows As Integer = myCommand.ExecuteNonQuery()

''close connection

myConnection.Close()

Dim returnValue As Integer

If (affectedRows > 0) Then

returnValue = myCommand.Parameters(

"@Id").Value

End If

Return returnValue

End Function

 

0
whisky
12/12/2006 8:44:13 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
843 Views

Similar Articles

[PageSpeed] 38
Get it on Google Play
Get it on Apple App Store

Do you have by any chance AutoEventWireup="true" in you ASPX page?
Regards,
Dejan Vesić

MCAD for .Net technologies | http://www.vesic.org/english/ | Blog: http://www.vesic.org/english/blog/
0
Dejan
12/12/2006 11:41:56 AM

Hi,

 Thanks for the response. No, I don't have

AutoEventWireup="true"

0
whisky
12/12/2006 12:10:02 PM
Reply:

Similar Artilces:

Item has already been added. Key in dictionary: 'Name' Key being added: 'Name'
I am trying to bind a hashtable to dropdopwlist as below but I get this:"Item has already been added. Key in dictionary: 'Name'  Key being added: 'Name'" Error. Any ideas?    Hashtable docs = new Hashtable();    foreach (string s in Roles.GetUsersInRole("Physician"))    {      ProfileCommon p = (ProfileCommon)ProfileCommon.Create(s);      string fullname = p.PersonalInfo.FirstName + " " + p.PersonalInfo.LastName;      docs.Add("Name", fullname);   &...

Item has already been added. Key in dictionary: 'cbo_' Key being added: 'cbo_'
When I use a module of a combobox, the error message is shown as below. Item has already been added. Key in dictionary: 'cbo_' Key being added: 'cbo_' Actually, in a same project, this module is also used in another webpages and it is ok but now I build a new one and the problem occurs.  How can I solve this problem? Thank you Actually, this problem occurs after I re-install windows xp and visual studio 2005. I found that the webpages wrote before are ok but the webpages after re-installation have this problem. These webpages are in the same project. After installation, I deleted...

Item has already been added. Key in dictionary: 'FitName' Key being added: 'FitName'
i am using a hashtable to keep key value pairbut i am getting an error like this Item has already been added. Key in dictionary: 'FitName'  Key being added: 'FitName'But i need a Collection which replaces the old if  we add the  same key againis there any such collection?  How about writing a custom put method like: private void putItem(HashTable myTable, string key, string value){    if( myTable.containsKey( key ) )           myTable.remove( key );   myTable.put( key, value); } Of course,...

Membership.GetAllUsers(); Item has already been added. Key in dictionary: '' Key being added: ''
 Hi, I get the following error while trying to retrive all the users in AD,Item has already been added. Key in dictionary: ''  Key being added: ''  i presume this is because a user has somehow been duplicated in th AD and the collection has to be unique. is there any method which gets all unique users as i cannot seem to find one. Thanks, Ommer Check the exist property of AD before adding user. Shah Dharnendra GSr.Analyst Programmer,GTL-Ahmedabad  Hi, is that to actually check whether a user exists in AD before adding another user? Is t...

Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'
hi , when i am trying to delete a project from the project_list page i'm getting the following error : Item has already been added. Key in dictionary: 'Id'  Key being added: 'Id' can anybody help me ? thanks.Lebanese Please post your code. It will help us assess your issue.Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question it's the time tracker starter kit code.Lebanese Charbel_Chalhoub wrote:it's the time tracker starter kit code. OK. Were you able to resolve it?Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to a...

Item has already been added. Key in dictionary: '0' Key being added: '0' gridview
i'm trying to add a key and value to the hashtable and then put that hashtable in Session and this works fine but i'm getting error when i try to browse to different pages in gridview and here is the error message: Item has already been added. Key in dictionary: '0'  Key being added: '0' gridview here is my code: Hashtable ht = new Hashtable();  //declare in class level variable  protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) {        ............      &nbs...

Please hekp, error: Item has already been added. Key in dictionary: 'id' Key being added: 'id'
I had that error before on FormView, I didn't find any solution, and managed to avoid that code. But now I really need a solution on this, please help. That happens when I reload page, on my page, my FormView is loaded dynamically, and that error happens on LoadControlState and LoadViewState,  in LoadControlState, it is on             if (objArray1[5] != null)            {                  Ord...

Hashtable error
Hi,  Can someone point me in the right direction? I have no idea why I get this error because I am quite sure that in my code, "ItemNo" is being added as a key for the FIRST time into the Hashtable.<code>Hashtable htCredent = new Hashtable();... (I have left out some chunks of code here that populates the datareader drCredent.)while (drCredent.Read()){htCredent.Add("ItemNo", drCredent.GetString(0)); (*** ERROR Line)htCredent.Add("ItemDescription", drCredent.GetString(1));htCredent.Add("GST", drCredent.GetDecimal(2));htCredent.Add("...

Refresh for second time a gridview which includes a second gridview, gives the error Item has already been added. Key in dictionary: 's_no' Key being added: '_no'
I have a gridview which includes another gridview in a template field. Included gridview is resfreshed in 'RowCreated' event of first gridview based on its' datakey values. 'Their data are refreshed by clicking a button. The first time both gridviews are filled with data without any problem. The next time I click on button for refreshing their data, I get the error Key in dictionary: 's_no'  Key being added: 's_no'. 's_no' is a datakey column of included gridview. What is the problem ?...

Key 'd' and Key 'Control'
Dear sirs / madams, I want to add a short cut key in my datawindow, the script as shown as below, Script 1 IF KeyFlags = 2 THEN IF KeyDown(Keyd!) THEN THIS.TriggerEvent("ue_deleterow") END IF END IF Script 2 IF KeyDown(KeyControl!) then IF KeyDown(Keyd!) then THIS.TriggerEvent("ue_deleterow") END IF END IF Script 3 IF KeyDown(KeyControl!) AND KeyDown(Keyd!) THEN THIS.TriggerEvent("ue_deleterow") END IF But, all of the above, if I press the Key 'Control' first, and then press Key 'd',...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

Error: Primary key for row in table 'x' is referenced by foreign key 'f' in table 'y'
(ASA 9 newest ebf) I'm getting this error even though mentioned foreign key has cascade updates (and deletes too) enabled. Is this some new behaviour in asa 9, or why can i get such message for cascaded foreign key? Any ideas? Thanks Pete Found a reason for it...but should it really work so? It's this way: - table a has columns a,b,c - table b has columns a,c, and references columns a,c (with a,c) in table a with cascade updates - table a hes before update trigger to change columns a when column b is changed (set new_row.a = ...) and that set new_row.a = ... i...

Web resources about - Item has already been added. Key in dictionary: 'Cellular' Key being added: 'Cellular' - asp.net.presentation-controls

Resources last updated: 11/27/2015 6:23:27 PM