Solved

ASP to ASPX

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

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…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

696 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