Himanshu

Himanshu

  • NA
  • 5
  • 0

error -----------plz help

Jan 19 2007 3:32 AM

hi
i am getting tthe following error in the bold lile
stream was not readable
so plz tell me how to resolve it
Private
Sub form1_load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

Strquery = "Select * from optimizer"

adp = New SqlDataAdapter(Strquery, con)

adp.Fill(ds, "optimizer")

cmdCommand = New SqlCommand(Strquery, con)

Try

dr = cmdCommand.ExecuteReader

fs = New FileStream("c:/abc.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)

sr = New StreamReader(fs)

For Each dr In ds.Tables()

sw.WriteLine(dr(0).ToString + "/t" + dr(1).ToString)

Next

sw.Close()

sr.Close()

dr.Close()

Catch ex As Exception

MessageBox.Show(ex.Message + " " + ex.StackTrace)

End Try

End Sub