ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 31st, 2003, 07:40 AM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
embedded Windows Media Player

hi,

i m designing an online songs application in which the user will request a song and it will play that song on the site and all other users which will log on after the first user will hear that song.

i know how to embed Windows Media Player in HTML but i donot know how to do it in ASP cause in HTML, the song path and name is hard coated but i want it dynamic means i want it to take songs form the database and then play.

so my questions are

1. can i embed Windows Media Player in my ASP page

2. can i make and open database connection in the following code

<object width="320" height="290"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
id="mediaplayer1">
<param name="Filename" value="kids.mpg">
<param name="AutoStart" value="True">
<param name="ShowControls" value="True">
<param name="ShowStatusBar" value="False">
<param name="ShowDisplay" value="False">
<param name="AutoRewind" value="True">
<embed
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="320" height="290" src="kids.mpg"
filename="kids.mpg" autostart="True"
showcontrols="True" showstatusbar="False"
showdisplay="False" autorewind="True">
</embed>
</object>

i will be very much thankful if you people give me some hints.

Shariq

Reply With Quote
  #2  
Old August 31st, 2003, 08:29 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
I've done this successfully before, but I'm going from memory here. If this doesn't work let me know and I'll check my code.

Connect to your db and select the path of the file from the db. Then you can loop thru the records.

where you have
<param name="Filename" value="kids.mpg">

and

<embed
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="320" height="290" src="kids.mpg"
filename="kids.mpg" autostart="True"
showcontrols="True" showstatusbar="False"
showdisplay="False" autorewind="True">
</embed>


use

<param name="Filename" value="<%=oRS("Filename")%>">

and

<embed
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="320" height="290" src="<%=oRS("Filename")%>"
filename="<%=oRS("Filename")%>" autostart="True"
</embed>

substitute Filename for whatever field you use in the db.

Reply With Quote
  #3  
Old August 31st, 2003, 08:38 AM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
thanks for your reply

but can u tell me that

<param name="Filename" value="<%=oRS("Filename")%>">

and

<embed
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="320" height="290" src="<%=oRS("Filename")%>"
filename="<%=oRS("Filename")%>" autostart="True"
</embed>

substitute Filename for whatever field you use in the db.

where should i create connection for the database before the embedding or where u have written Filename

Reply With Quote
  #4  
Old August 31st, 2003, 09:54 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Create an asp page - call it .asp. At the top of your page put your connection info or better yet include it in a separate asp file so that you can call it from different pages. Are you using MS SQL server? Access? MySQL? Are you using a DSN, an OLEDB or an ODBC connection.

Code:

<%

'declare the variables
Dim SQLstr 'as string
Dim oRS 'as recordset
Dim dbConn 'as database connection

'create the connection
set dbConn = Server.CreateObject ("ADODB.Connection")
'if it's an access database for example, list the connection stream
dbConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
	& "Data Source=C:\path\dbfilename.mdb "
'open the db
dbConn.Open


'select the field from the database where the filename is stored
SQLstr = "Select tblfield from tblname"

'execute the SQL statement and create a recordset to hold the filenames

set oRS = dbConn.Execute(SQLstr)

'check to see if the recordset is empty
If not oRS.eof then

   Do while not oRS.eof

<object width="320" height="290" 
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
id="mediaplayer1"> 
<param name="Filename" value="<%=oRS("tblname")%>"> 
<param name="AutoStart" value="True"> 
<param name="ShowControls" value="True"> 
<param name="ShowStatusBar" value="False"> 
<param name="ShowDisplay" value="False"> 
<param name="AutoRewind" value="True"> 
<embed 
type="application/x-mplayer2" 
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" 
width="320" height="290" src="<%=oRS("tblname")%>"
filename="<%=oRS("tblname")%>" autostart="True" 
showcontrols="True" showstatusbar="False" 
showdisplay="False" autorewind="True"> 
</embed> 
</object> 


   oRS.Movenext
   Loop

Else
   Response.Write "There are no songs in the database."
End if

'close the recordset
Close.oRS
Set oRS = nothing

'close the connection
Close.dbConn
set dbConn = nothing

%>

Reply With Quote
  #5  
Old September 6th, 2003, 12:46 PM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
i have a problem that when a user request some song for playing then it will play that request but i want that this user will not post anyother requested for minimium 24 hours. one thing that is in my mind is to get the ip address but it is not good because if there is a network then there will be a same ip generated for the workstations and the other is to make cookies and that i donot know how to make cookies.


and also tell me call a field from a table in a select box



Shariq

Reply With Quote
  #6  
Old September 6th, 2003, 01:33 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
There are several tutorials on this site on how to create cookies (you will need a login system) using ASP. Just follow them.

for select boxes, open the connection to the database then

<%

SQLstr = "select ID, Fieldname from tblname"
set oRS = dcnDB.Execute(SQLstr)

%>

<select name="iSID">

<% Do while not oRS.eof %>

<option value="<%=oRS("ID")%>" ><%=oRS("Fieldname")%></option>

<%
oRS.movenext
Loop
%>

</select>

<%
close.oRS
set oRS = nothing
close.dcnDB
set dcnDB = nothing
%>

Reply With Quote
  #7  
Old September 7th, 2003, 01:45 AM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
tell me what to write after Data Source=

"Provider=OraOLEDB.Oracle;User ID=user;Password=pwd;Data Source=constr;"

in access we write the path of the database but what will i write in oracle adn also tell me is this the correct connection string.

Reply With Quote
  #8  
Old September 7th, 2003, 03:00 AM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 17
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
this article contains information about all connection strings:
http://www.able-consulting.com/ado_conn.htm
__________________
- Rogier Doekes

Reply With Quote
  #9  
Old September 7th, 2003, 05:05 AM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
In this code i have made a select box which will populated from the DB but in return i want another page which will populate a select box from the DB for e.g

if a user selects mircosoft or Oracle on this page then he will get a select box on the other page which will populate Microsoft`s products and oracle`s Product if select.

how can i reference item selected on this page on the response.asp page.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<%

'declare the variables
Dim SQLstr 'as string
Dim oRS 'as recordset
Dim dbConn 'as database connection

'create the connection
set dbConn = Server.CreateObject ("ADODB.Connection")
'if it's an access database for example, list the connection stream
dbConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
& "Data Source=C:\path\dbfilename.mdb "
'open the db
dbConn.Open

'select the field from the database where the filename is stored
SQLstr = "select ID, Fieldname from tblname where typeid= 2"
set oRS = dbConn.Execute(SQLstr)


%>
<form action="response.asp" method=get>
<select name="iSID" onChange="MM_jumpMenu('parent',this,0)">
<% Do while not oRS.eof %>
<option selected>Please Select One</option>
<option value="<%=oRS("ID")%>"><%=oRS("Fieldname")%></option>

<%
oRS.movenext
Loop
%>

</select>

<%
close.oRS
set oRS = nothing
close.dbConn
set dbConn = nothing
%>
</form>
</body>
</html>
---------------------------------------------------

Reply With Quote
  #10  
Old September 7th, 2003, 08:11 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
You just do a

Dim userselecteditem
userselecteditem = request.form("iSID") on the next page (if you use a post. You should use posts instead of gets. For gets, you would need a request.querystring)

and then create a new select box with the SQL statement where ID =" & userselecteditem

It seems like you need to learn some of the fundamentals of asp. In addition to the tutorials on this site, other good resources are
www.asp101.com and www.aspfaqs.com

Reply With Quote
  #11  
Old September 9th, 2003, 09:21 AM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
i m getting an error in the below please help me out


'create the connection
set dbConn = Server.CreateObject ("ADODB.Connection")
'if it's an access database for example, list the connection stream
dbConn.Open dbConn
dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\new\new.mdb;Persist Security Info=False;DBQ=c:\inetpub\wwwroot\new\new.mdb;Driv erId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"

'dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"
' "URL=c:\inetpub\wwwroot\new\new.mdb;"
'dbConn.Open
'open the db
'dbConn.Open dbConn

-------

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/new/english.asp, line 28


where line 28 is
set dbConn = Server.CreateObject ("ADODB.Connection")


Shariq

Reply With Quote
  #12  
Old September 9th, 2003, 06:11 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
check out the tips on this page to address your problem

http://www.aspfaq.com/show.asp?id=2009

Reply With Quote
  #13  
Old October 8th, 2003, 06:22 AM
shrry8 shrry8 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 32 shrry8 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 37 sec
Reputation Power: 16
how to see my database images

Hi

i want to know kay how can i see the uploaded images on a Database means i have uploaded some images in a Database and now i want to see that images in a browser. how can do this

tell me



Shariq

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > embedded Windows Media Player


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap