Solved

ASP to ASPX

Posted on 2015-01-06
3
42 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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 …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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