| | |
how to show data from database in label?
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2006
Posts: 4
Reputation:
Solved Threads: 0
here the code i've try....but still not working....please help me..
<page_load>
id = 6
dbconn = New SqlClient.SqlConnection("workstation id=HOME-5F227C8500;packet size=4096;user id=sa;initial catalog=pubs;persist security info=False")
dbconn.Open()
sql = "select * from NEWS Where NewsID='" & id & "'"
dbcomm = New SqlClient.SqlCommand(sql, dbconn)
Try
dbread = dbcomm.ExecuteReader(CommandBehavior.CloseConnection)
While dbread.Read()
lbl1.Text = dbread("NewsID")
lblModel.Text = dbread("NewsModel")
lblPrice.Text = dbread("NewsPrice")
lblDescription.Text = dbread("NewsDescription")
Image5.ImageUrl = (dbread("NewsPic"))
Image5.DataBind()
Image5.ToolTip = (dbread("NewsModel"))
End While
dbread.Close()
dbconn.Close()
Catch ex As Exception
End Try
<page_load>
id = 6
dbconn = New SqlClient.SqlConnection("workstation id=HOME-5F227C8500;packet size=4096;user id=sa;initial catalog=pubs;persist security info=False")
dbconn.Open()
sql = "select * from NEWS Where NewsID='" & id & "'"
dbcomm = New SqlClient.SqlCommand(sql, dbconn)
Try
dbread = dbcomm.ExecuteReader(CommandBehavior.CloseConnection)
While dbread.Read()
lbl1.Text = dbread("NewsID")
lblModel.Text = dbread("NewsModel")
lblPrice.Text = dbread("NewsPrice")
lblDescription.Text = dbread("NewsDescription")
Image5.ImageUrl = (dbread("NewsPic"))
Image5.DataBind()
Image5.ToolTip = (dbread("NewsModel"))
End While
dbread.Close()
dbconn.Close()
Catch ex As Exception
End Try
•
•
Join Date: Dec 2008
Posts: 104
Reputation:
Solved Threads: 18
Try this:
lbl1.Text = dbread("NewsID").ToString()
lblModel.Text = dbread("NewsModel").ToString()
lblPrice.Text = dbread("NewsPrice").ToString()
lblDescription.Text = dbread("NewsDescription").ToString()
Image5.ImageUrl = (dbread("NewsPic")).ToString()
Image5.DataBind()
Image5.ToolTip = (dbread("NewsModel")).ToString()
lbl1.Text = dbread("NewsID").ToString()
lblModel.Text = dbread("NewsModel").ToString()
lblPrice.Text = dbread("NewsPrice").ToString()
lblDescription.Text = dbread("NewsDescription").ToString()
Image5.ImageUrl = (dbread("NewsPic")).ToString()
Image5.DataBind()
Image5.ToolTip = (dbread("NewsModel")).ToString()
![]() |
Similar Threads
- retrieving a single cell of data from a MySQL database (PHP)
- how to read data from database page by page, please it is urgent... (JSP)
- How to store data in data grid to database by single mouse click in Asp.net (ASP.NET)
- copy data from excel to vb database (Visual Basic 4 / 5 / 6)
- Please help(Problem in insertion data to database) (JSP)
- Inserting Data into Access Database (Java)
- Info in Database converted to Chart (Visual Basic 4 / 5 / 6)
- Posting form data to an Oracle database (JavaScript / DHTML / AJAX)
- help with database assignment (Java)
Other Threads in the ASP.NET Forum
- Previous Thread: Only post time
- Next Thread: How to create a pm alert notice
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers






