Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP to ASPX

Posted on 2015-01-06
3
Medium Priority
?
45 Views
Last Modified: 2016-03-30
Hi,

The below code is working fine with ASP :
<%

on error resume next

 Dim objConn, objRS,objRS1, strQuery,objRS3,strQuery1,strQuery3
Dim strConnection
Set objConn = Server.CreateObject("ADODB.Connection")
                   
strConnection = "Provider=sqlncli10;Data Source=localhost;Initial Catalog=db1;User Id=m1;Password=m1111;"

 objConn.Open strConnection

strQuery3="select * from yearing"
set objRS3 = objConn.Execute (strQuery3)
<option selected><%=year(date())%></option>

    <%      Do while not objrs3.EOF%>
       <option> <%=objrs3("years1")%> </option>
       <% objrs3.movenext
               loop%>

But not working with ASPX. What changes need to be done?
Note I am using SQL 2008

Thanks
0
Comment
Question by:abdallah1973
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
Tom Chadaravicius earned 2000 total points
ID: 40534918
You need to select language you want to use for CodeBehind. The options are: c# (C sharp), VB (Visual Basic), C++. Since you are seemingly familiar with the old Active Server Pages (ASP), you may want to try Visual Basic.
*There's also a not-so-popular option of VJ (Visual Java).
For starters, create a new project in Visual Studio (2002 or newer).
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 40535024
Yes , you need to change the code .

as per snippet for code it seems like you need to populate dropdown from database .

to do this code sample

Dim cmd As New SqlCommand("SELECT * FROM [tblOne]", New SqlConnection(ConfigurationManager.AppSettings("ConnString")))cmd.Connection.Open()
Dim ddlValues As SqlDataReaderddlValues = cmd.ExecuteReader()
DropDownList1.DataSource = ddlValues
DropDownList1.DataValueField = "theName"
DropDownList1.DataTextField = "theName"
DropDownList1.DataBind()
cmd.Connection.Close()
cmd.Connection.Dispose()
whole code details here
http://www.dbtutorials.com/advanced/populatedropdown-vb/
1
 

Author Closing Comment

by:abdallah1973
ID: 41528658
good one
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question