Hi Friends!!
I have done a task of Importing excel in SQL server 2000 using Vb.Net 2003. I have provided Import/Overwrite facility to the User here. For this i used a Combobox. I have inserted values in Combo at design time. From the Property, Items (Collection). In Code i checked the Combobox.text. If it is Overwrite then i done Update else Insert.

My problem is Its running fine some time and some time insted of Overwrite its doing both the tasks. Overwrite and Import. I am unable to fine the problem. Can any one help/guide me. Where can be the problem. If needed i will put my logic here. Let me know for it.
TIA.

You can set values in code too:

ComboBox1.Items.Clear()
ComboBox1.Items.Add("Import")
ComboBox1.Items.Add("Overwrite")
' Predefined values, no user input allowed
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList

And to check for the user's choice

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  ' Check user selection
  If ComboBox1.SelectedIndex = 0 Then
    ' Import selected
    ' Do import
  ElseIf ComboBox1.SelectedIndex = 1 Then
    ' Overwrite selected
    ' Do overwrite
  End If

End Sub

If you still get both Overwrite and Import, post some code here.

Hi,
Thanks for your help. :) i got the problem. Its was due to database.
Its containing wrong data ( of testing) so i was facing problem.

I see :D If your question is solved, please mark the thread as solved. Thank you!

Oh..ya. thanks for reminding me . I forgotten. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.