Trinity_Florida
New Member
My Connection is declared and opened. What is this Error Msg about? <BR><BR><%@ Page Language="vb" Debug="true" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.SqlClient" %><BR><BR><BR><BR><%<BR>dim x as integer<BR>dim item as string<BR> Dim myConnection As SQLConnection<BR> Dim myCommand As SQLCommand<BR> myConnection = New SQLConnection( "Server=srvr;uid=sa;pwd=;Database=db" )<BR><BR> myConnection.Open()<BR><BR>x=1<BR>For each item in request.form<BR><BR>if request.form("myRepeater:ctrl" & trim(str(x)) & ":approved") = "on" then<BR><BR>dim extra as string = request.form("myRepeater:ctrl" & trim(str(x)) & "rodid")<BR>dim eggstra as string = request.form("myRepeater:ctrl" & trim(str(x)) & "roddesc")<BR> <BR>myCommand = NEW SQLCommand("INSERT INTO SQLADD (name,lastname) values('extra','eggstra')")<BR>'response.write (request.form("myRepeater:ctrl" & trim(str(x)) & "rodid"))<BR>'response.write (request.form("myRepeater:ctrl" & trim(str(x)) & "roddesc"))<BR>myCommand.ExecuteNonQuery() <BR> <BR>end if<BR>x = x+1<BR> <BR>next<BR><BR>myCommand.ExecuteNonQuery() <BR>MyConnection.Close()<BR><BR>%>Your querystring is missing the reference to myConnection:<BR><BR><BR>myCommand = NEW SQLCommand("INSERT INTO SQLADD (name,lastname) values('extra','eggstra')", MyConnection)<BR><BR>