?
Solved

ASP to ASPX

Posted on 2015-01-06
3
Medium Priority
?
43 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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
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’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 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