DataGrid problem (newbie)

S

Saber S

I'm very new to ASP.Net and it is my first code. I'm using Visual
Studio.Net.
When I run this code I see a blank page in browser (pasted at the end of
this email)
what's wrong?


Public Class WebForm1

**CENSORED!!** (default vs.net codes without change)

Dim connect As New
System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB.1;Password=;User
ID=saber;Initial Catalog=persiantools;Data Source=localhost;")
Dim SQLstr As String = "SELECT * FROM polltable "
connect.Open()
Dim myDataAdapter As New System.Data.OleDb.OleDbDataAdapter(SQLstr, connect)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet, "polltable")
DataGrid1 = New DataGrid
DataGrid1.DataSource = myDataSet.Tables("polltable")
DataGrid1.DataBind()
connect.Close()
End Sub
End Class



<THE RESULT I GET>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDw....CENSORED!..9KeoZNvUDg==" />

</form>
</body>
</HTML>
 
M

Marina

All you did was create a DataGrid object in memory. You never actually added
it to the page's controls collection.
 
S

Saber S

Thanks for answer, but how?

Marina said:
All you did was create a DataGrid object in memory. You never actually added
it to the page's controls collection.
 
S

Saber S

Thanks Demetri,
A person emailed me and told me about that.
Thanks for your answer,
more questions soon ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top