.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 19th, 2003, 01:03 PM
Ray Southern Ray Southern is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 Ray Southern User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Newbie ASP.NET Question

Heya Ppl,

I'm trying to plug two subroutines into a codebehind file...one to fire when the page is loaded, the other one gets triggered when a button is pressed on the display page.

Thing is, when I run the page, it tries to run both subs at once...at least, that's the impression I'm getting.

I'm getting an error message at Line 47 of bulkadd.vb (BC30105: Number of indices is less than the number of dimensions of the indexed array.). That shouldn't happen since the function isn't supposed to be triggered yet.

Below is my code....I could REALLY use the help.

Thanks in advance



(BulkAdd.vb)
Imports System
Imports System.Data
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient

Public Class bulkadd
Inherits Page

Public maillist As DropDownList
Public conPubs As Sqlconnection
Public cmdSelect As SqlCommand
Public dtrTitles As SqlDataReader
Public sqlcmdstr As String

Sub Page_Load

conPubs = New SQLConnection("CONNECTION INFO")

Dim company_id As Integer

company_id= 5

sqlcmdstr= "SELECT title,list_table_name FROM m_mailing_list WHERE m_mailing_list.company_id='" & company_id & "'"
cmdSelect= New SQLCommand (sqlcmdstr, conPubs)
conPubs.Open()

dtrTitles= cmdSelect.ExecuteReader()

maillist.DataSource=dtrTitles
maillist.DataValueField= "list_table_name"
maillist.DataTextField= "title"
maillist.DataBind()

dtrTitles.Close()
conPubs.Close()
End Sub


Sub address_add(s As Object, E As EventArgs)
Dim badentries As String
Dim newemailaddresses() As String

conPubs = New SQLConnection("CONNECTION INFO")

newemailaddresses()= split(bulkadd.text, "\n")
Do While i < Ubound(newemailaddresses,2)

sqlcmdstr= "SELECT email FROM " & maillist.value & " WHERE email= '" & newemailaddress(i) & "'"
cmdSelect= New SQLCommand (sqlcmdstr, conPubs)
conPubs.Open()

dtrTitles= cmdSelect.ExecuteScalar()

if dtrTitles.HasRows THEN
badentries= newemailaddresses(i) & "\n" & badentries
dtrTitles.Close()
conPubs.Close()
Else
dtrTitles.Close()
conPubs.Close()

sqlcmdstr= "INSERT INTO " & maillist.value & " (email) VALUES ('" & newemailaddresses(i) & "')"
cmdSelect= New SQLCommand (sqlcmdstr, conPubs)
conPubs.Open()
cmdSelect.ExecuteNonQuery()
conPubs.Close()
End If

i=i+1
Loop

'Possibly stuff bad entries into label text

End Sub


End Class




In case it helps, here's the front end as well

(bulkadd.aspx)
<%@ Page Inherits="bulkadd" Src="bulkadd.vb"%>

<html>
<form runat="server">

<asp:textbox
id="bulkadd"
textmode="multiline"
cols="20"
rows="5"
runat="server" />

<aspropDownList
id="maillist"
runat="server" />

<asp:Button
text="BulkAdd"
onClick="address_add"
Runat="Server" />

</form>
</body>
</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Newbie ASP.NET Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT