Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is Datagrid in VS 2005

Status
Not open for further replies.

teferi2002

Technical User
Sep 24, 2005
81
0
0
US
Hi all,
I wonder where the datagird is hidding in visual studio 2005.
 
Nowhere - It's now called a GridView and has been improved


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
it is called GridView now.

And you do not need to set up a Data Adapter for it because you can link it directly to the Connection through the GUI.
 
The reson i am asking for the datagrid is becasue i have a code written to read a data using datareader and display it in dagagrid. It was easy to do that and i just got a new vs 2005 and I do not really know how to convert the code to work in gridview. I wonder if gridview supports executeReader() method to populate a datareader?
Many thanks to all


<Script runat="server" language="VB">


Dim myConnection as OleDbConnection
Dim dr as OleDbDataReader
Dim cmd as OleDbCommand
Dim connectionString as string
Dim i As Integer
Dim filename as string
Dim sb as System.Text.StringBuilder
Dim myConnectionc as OleDbConnection
Dim drc as OleDbDataReader
Dim cmdc as OleDbCommand
Dim connectionStringc as string
Dim StrSql as string



Sub page_load()
lblTime.Text =DateTime.Now.ToString()

connectionString = "provider=MSDAORA;Data Source=tplp;User ID=tplcp;Password=tplcp;"
myConnection = new OleDbConnection(connectionString)
myConnection.Open()

StrSql= "SELECT (substr( ITEM ,1,4)||'.'||substr(item,5)) Item_Number, IDESCR Short_Description, IDESCRL Long_Description, IUNITS Unit_Name," Plan_Unit_Description " & _
"FROM ITEMLIST " & _
" WHERE ISPECYR='00' AND IOBSELET='N' and ITEM <> '2999509/00001' "

cmd = New OleDbCommand(StrSql,myConnection)
dr = cmd.ExecuteReader()
dgMetric.DataSource =dr
dgMetric.DataBind()

connectionStringc = "provider=MSDAORA;Data Source=tplp;User ID=tplcp;Password=tplcp;"
myConnectionc = new OleDbConnection(connectionStringc)
myConnectionc.Open()

filename = "EnglishItemList.csv"
cmdc = New OleDbCommand(StrSql,myConnectionc)



drc = cmdc.ExecuteReader()
sb = New System.Text.StringBuilder



End sub



Sub Click(ByVal sender as System.Object, ByVal e as System.EventArgs)





'for field name
For i=0 to drc.FieldCount-1
If i < (drc.FieldCount-1) then
sb.Append(Chr(34)&drc.GetName(i)&Chr(34)&",")
Else
sb.Append(Chr(34)&drc.GetName(i)&Chr(34)& VbCrLf)
End If
Next


'for field value
While drc.Read()
For i=0 to drc.FieldCount-1
If i < (drc.FieldCount-1) then
sb.Append(Chr(34) & drc.GetValue(i).ToString.Replace(Chr(34),Chr(34) & Chr(34)) & Chr(34) & ",")

'sb.Append(Chr(34)&drc.GetValue(i).ToString & Chr(34)&",")
Else
sb.Append(Chr(34)&drc.GetValue(i).ToString & Chr(34)& VbCrLf)
End if
Next

End while
drc.close()
myConnectionc.Close()
Response.ContentType ="Application/x-csv"
Response.AddHeader("content-disposition","attachment;filename="""& filename &"""")
Response.Write(sb.ToString)
Response.End()

End Sub


</Script>
 
Why doen't you try it and see what happens?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top