Re: Change the way a file name is displayed (remove the c:\ and change to http)
From: Joshua C. Clark (Josh_at_NetworkMedics.Com)
Date: 09/13/04
- Next message: Bruce Pullum: "ASP.NET cn.open / BLANK ALERT WINDOW"
- Previous message: Bruce Hensley: "sleep, wait, or pause in HTML page"
- In reply to: Joshua C. Clark: "Re: Change the way a file name is displayed (remove the c:\ and change to http)"
- Next in thread: Michael Harris \(MVP\): "Re: Change the way a file name is displayed (remove the c:\ and change to http)"
- Reply: Michael Harris \(MVP\): "Re: Change the way a file name is displayed (remove the c:\ and change to http)"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Sep 2004 14:13:31 -0400
When I use the new code I get,
http://small\image.jpg instead of http://small/image.jgp
Any ideas why, here is my NEW code with your changes, again thanks!
' on error resume next
strComputer = "."
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery("Select * from CIM_DataFile where
Path = '\\small\\'")
For Each objFile in colFiles
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DSN=Filename;"
objRecordset.CursorLocation = adUseClient
objRecordset.Open "SELECT * FROM Filename" , objConnection, adOpenStatic,
adLockOptimistic
objRecordset.AddNew
objRecordset("Filename") = Replace(objFile.Name, "c:\", "http://", 1, -1,
vbTextCompare)
objRecordset.Update
Next
objRecordset.Close
objConnection.Close
"Joshua C. Clark" <Josh@NetworkMedics.Com> wrote in message
news:ePkRN$amEHA.828@TK2MSFTNGP10.phx.gbl...
> Thats it, works beutifully, thank you!
>
>
> "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
> news:%23iNW0vamEHA.1904@TK2MSFTNGP09.phx.gbl...
> > Joshua C. Clark wrote:
> >
> > > What I would like to do in my script is change the c:\ to http://
before
> it
> > > is written in my database, any help would be great, thanks!
> > >
> > > ' on error resume next
> > >
> > > strComputer = "."
> > > Const adOpenStatic = 3
> > > Const adLockOptimistic = 3
> > > Const adUseClient = 3
> > > Set objWMIService = GetObject("winmgmts:" &
> > > "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
> > > Set colFiles = objWMIService.ExecQuery("Select * from CIM_DataFile
where
> > > Path = '\\small\\'")
> > >
> > > For Each objFile in colFiles
> > >
> > > Set objConnection = CreateObject("ADODB.Connection")
> > > Set objRecordset = CreateObject("ADODB.Recordset")
> > > objConnection.Open "DSN=Filename;"
> > > objRecordset.CursorLocation = adUseClient
> > > objRecordset.Open "SELECT * FROM Filename" , objConnection,
> adOpenStatic,
> > > adLockOptimistic
> > > objRecordset.AddNew
> > > objRecordset("Filename") = objFile.Name
> > Hi
> >
> > Replace the line above with this and see if it gives you what you want:
> >
> > objRecordset("Filename") = _
> > Replace(objFile.Name, "c:\", "http://", 1, -1, vbTextCompare)
> >
> >
> > --
> > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> > Administration scripting examples and an ONLINE version of
> > the 1328 page Scripting Guide:
> > http://www.microsoft.com/technet/scriptcenter/default.mspx
>
>
- Next message: Bruce Pullum: "ASP.NET cn.open / BLANK ALERT WINDOW"
- Previous message: Bruce Hensley: "sleep, wait, or pause in HTML page"
- In reply to: Joshua C. Clark: "Re: Change the way a file name is displayed (remove the c:\ and change to http)"
- Next in thread: Michael Harris \(MVP\): "Re: Change the way a file name is displayed (remove the c:\ and change to http)"
- Reply: Michael Harris \(MVP\): "Re: Change the way a file name is displayed (remove the c:\ and change to http)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|