Just a thought, i think this happened to me once before, try closing con, conmes and coninter when you're finished with them ( i.e. con.Close() ). As far as the program is concerned, everything is disposed of, but the server / database is still hanging open with 100s of connections.
Let us know if this works. On Jun 16, 3:30 pm, Jeena Ajiesh <[email protected]> wrote: > Hi all, > Im having a table with about 1000s of records, these records wil cahnge > according to the username that is entered.Sometimes may be 100 records under > that username. > The thing is that we i try to take the rows from that table and write it in > another new table along with some other information, not all the rows are > inserting. > Say i have 500 rows, but wen inserting into new tables may be 100 or 200 > rows will be inseted.And only that much row is fetched to the grid. Hw can i > fetch all the drows? > Do any one have any idea abt this? > Im wrking in vs2005, asp.net lang and sql server 2000 > > I will post by sample codes here. > > Dim strall As String = "Select distinct mble from Stud where Username='" & > lblusername.Text & "'" > > Dim conn As New SqlConnection(constr) > > Try > > conn.Open() > > Dim cm As New SqlCommand(strall, conn) > > Dim sdr As SqlDataReader = cm.ExecuteReader > > If sdr.HasRows = True Then > > While (sdr.Read()) > > mble = sdr("mblemobile") > > lan = rbdlang.SelectedItem.Value > > statu = "Q" > > msg = txt.Text > > If res = "0" Then > > Label1.Text = "Please select the parameter" > > Exit Sub > > ElseIf res = "1" Then > > Dim strsqll As String = "Insert into Generate > (Username,Mble,Mess,Lang,Status)Values('" & lblusername.Text & "','" & mble > & "','" & msg & "','" & lan & "','" & statu & "') " > > Dim con As New SqlConnection(constr) > > Dim cmd As New SqlCommand(strsqll, con) > > con.Open() > > cmd.ExecuteNonQuery() > > Dim strMes As String = "Insert into > inter(Username,Mble,Mess,Lang,Status)Values('" & lblusername.Text & "', '" & > mble & "','" & msg & "','" & lan & "','" & statu & "') " > > Dim conMes As New SqlConnection(constr) > > Dim cmdMes As New SqlCommand(strMes, conMes) > > conMes.Open() > > cmdMes.ExecuteNonQuery() > > Else > > Dim msgfrm As String > > msgfrm = lblSchool.Text > > Dim strinter As String = "Insert into InterS > (Username,Mble,Mess,Lang,MsgType,Status)Values('" & lblusername.Text & "', > '" & mble & "','" & msg & "','" & lan & "','" & msgfrm & "','" & statu & "') > " > > Dim coninter As New SqlConnection(constr) > > Dim cmdinter As New SqlCommand(strinter, coninter) > > coninter.Open() > > cmdinter.ExecuteNonQuery() > > End If > > End While > > Else > > err.Text = "No Record" > > Exit Sub > > End If > > Hope this info is enough !! > > -- > **************** > Thanks & Regards, > Jeena Ajiesh > Email: [email protected] > [email protected]
