Solved

ASP to ASPX

Posted on 2015-01-06
3
20 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
3 Comments
 
LVL 4

Accepted Solution

by:
Tom Chadaravicius earned 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now