|
hello abglorie,
in the database change the datatype of the datefieldname as varchar(50)
u will get or in the query write it as
select convert(varchar(10),getdate(),101) or 103
ok byee
murali
|
|
|
|
|
yesterday Mr.John sir has helped me in one issue which is related to the same task
code---
else if (txtHospitalName.Text== "Medb" || txtHospitalName.Text== "Medw")
{ FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav");
if (thefile1.Exists)
{
File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension);
GetData();
}
hello frns
the above is the snippet of code i used in my application what i am doing is copying a file and saving it with the someother name its working fine, but the actual problem is i'll be having two types of files in my folder one is .mp3 and .wav .
so in the above code i am checking only the .wav file
note: i'll be entering only the name of the file without extension, there may be any one of the two filetypes.
what are the modifications/additions i have to make in my code to check for two types of file extensions
thanks for ur replies in advance
|
|
|
|
|
sunilwise wrote: FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav");
if (thefile1.Exists)
{
File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension);
GetData();
}
<br />
FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav");<br />
<br />
if (!thefile1.Exists){<br />
thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".mp3");<br />
}<br />
<br />
if (thefile1.Exists)<br />
{<br />
File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension);<br />
GetData();<br />
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
thanks for u r answers sir its working fine
|
|
|
|
|
how to convert date time day from text datatype
for example text field=2007/11/13,04:38:14:859
and i want to convert this text(2007/11/13) into date formate Like(13 Nov 2007- Tuesday ) in MSaccess
please help
Piyush Vardhan Singh
|
|
|
|
|
use like this
date.ToString("DD/mm/yyyy")
can solve ur problem.
Devjit Das.
|
|
|
|
|
or plz go through this link.
http://idunno.org/archive/2004/14/01/122.aspx
Devjit Das.
|
|
|
|
|
Hi All,
I have a secure certificate, and I want to use it to secure ONLY the login.aspx page. So, I need the user to make a request for http://localhost/protectedpage.aspx, get redirected to https://localhost/login.aspx, and once logged in, get redirected back to the protectedpage.aspx using http.
I have the code in place to do all this redirecting stuff, but the problem is that, once the user has been redirected back to the orignal page (protectedpage.aspx) after logging in, they get sent straight back to login.aspx as they are still deemed to be NOT logged in on http:// requests. If I change the url to request the protectedpage.aspx using https, it goes in no problem.
It is as if forms autentication only authenticates the user for the protocol used in the initial request to the login page.
Can anyone help me to understand what is going on here, and suggest what I can do about it?
Many thanks,
Martin
|
|
|
|
|
Hi i asked this question my pre msg...,
But in that post our guys & seniors not get whats the probs exactly...,
So i am posting here some what briefly,So plz u guys dont say its a cross post & lengthy...,
Advance Thanks For all...,
My question follows here:
I am want to bind some datas in my hashtable...,
I have some records in my datatable...,
Example:
mainId Maindesc PNo Link_Tit Link
1 Admin 134 Admin Form1..aspx
2 Gen.M 106 Maste frmPr.aspx
3 Hum.R 165 HR123 frmwo.aspx
4 Salar 201 HRsal frmsa.aspx
7 Cashe 126 Cashe frmCa.aspx
8 Chequ 159 Cheqy frmch.aspx
9 Bills 161 Cash1 frmca.aspx
dt = mydataset.Tables(0)
From that i bind one field(Maindesc) values in arraylist(ts.tabtext)...,
Dim _Text As ArrayList = New ArrayList
For Each dr As DataRow In dt.Rows
If Not _Text.Contains(dr("MainDesc").ToString) Then
_Text.Add(dr("MainDesc").ToString)
End If
Next
ts = CType(Me.FindControl("TabStrip1"), JQD.TabStrip)
ts.TabText = _Text
Now based on that arraylist text values it have to bind another field(PNames) values to hashtable...,
Dim _SubTabText As Hashtable = New Hashtable
_Text = New ArrayList
For Each tabtextobj As Object In ts.TabText
Dim tabtext As String = tabtextobj.ToString()
Dim drs() As DataRow = dt.Select("MainDesc='" + tabtext + "'")
Dim _SubText As ArrayList = New ArrayList
For Each dr As DataRow In drs
_SubText.Add(dr("Link_Title")).ToString()
Next
_SubTabText.Add(drs(0)("MainId") - 1, _SubText)'In this place binding in hashtable it have to be bind on that ts.tabtext based
Next
ts.SubTabTextCol = _SubTabText
But in that hashtable binding is not binding based on the arraylist text...,
Still that 4th MainId i can able to bind MainDesc and its Link_Title records properly..,
After that Mainid 5th & 6th is not there so its binded 7th,8th,9th MainDesc...,
But here that Link_Title are not binded based on that Maindesc row...,
Its left that 7th & 8th mainid, Link_Title...,
After that its binded that 7th mainId Link_Title In 9th mainId...,
Its my probs...,
Plz Any One give me some solution for this to bind based on the proper format...,
-- modified at 7:26 Tuesday 13th November, 2007
Regards,
Mageshh
|
|
|
|
|
HMagesh wrote: After that its binded that 7th mainId Link_Title In 9th mainId...,
Its my probs...,
Is it your probs?? What is your problem?? Are you getting this error "object reference not set to an instance of object"?? Which line are you getting this error?? I really don't understand what you are trying to say... BTW, don't bold the code.. use "code formatting" for pasting the code here..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hello Michael,
Thanks For Ur reply...,
See i have given some what good format here...,
In my Datatable I have This Records:
Id Name Dep
11 Mage Mca
11 Mage Mba
12 Sami MCom
13 Ravi BSC
16 Resh BCA
17 Gani BTech
18 Mani BA
dt = mydataset.Tables(0)
In that Name I dont want repeat Same Name and i have to bind in arraylist..,So i did my code as:
Dim _Text As ArrayList = New ArrayList
For Each dr As DataRow In dt.Rows
If Not _Text.Contains(dr("Name").ToString) Then
_Text.Add(dr("Name").ToString)
End If
Next
ts = CType(Me.FindControl("TabStrip1"), JQD.TabStrip)
ts.TabText = _Text
Now Based On the Arraylist Name i want to bind Dep in hashtable...,So i did code as:
Dim _SubTabText As Hashtable = New Hashtable
_Text = New ArrayList
For Each tabtextobj As Object In ts.TabText
Dim tabtext As String = tabtextobj.ToString()
Dim drs() As DataRow = dt.Select("Name='" + tabtext + "'")
Dim _SubText As ArrayList = New ArrayList
For Each dr As DataRow In drs
_SubText.Add(dr("Dep")).ToString()
Next
'Here based on that Id i am binding Dep...,Still Ravi Its binded properly in that hashtable...,
'After that its binded that Mani Name Dep as BCA...,and its not bind any Dep in Name Of Resh & Gani
_SubTabText.Add(drs(0)("Id") - 1, _SubText)
Next
ts.SubTabTextCol = _SubTabText
I hope u guys understand what i am asking...,
If any one knows solution,help me to solve...,
Regards,
Mageshh
|
|
|
|
|
Hi HMagesh,
I want to help you but I still have a few confusion about your code..
HMagesh wrote: ts = CType(Me.FindControl("TabStrip1"), JQD.TabStrip)
ts.TabText = _Text
What is "JQD.TabStrip" ??
I understand that you want the unique name from database and want to add those unique name to ArrayList.
HMagesh wrote: _Text = New ArrayList
Why do you clear all data after adding the unique name to this ArrayList?
<br />
Dim _SubTabText As Hashtable = New Hashtable<br />
For Each tabtextobj As Object In ts.TabText<br />
Dim tabtext As String = tabtextobj.ToString()<br />
Dim drs() As DataRow = dt.Select("Name='" + tabtext + "'")<br />
Dim _SubText As ArrayList = New ArrayList<br />
<br />
For Each dr As DataRow In drs<br />
_SubText.Add(dr("Dep")).ToString()<br />
Next<br />
<br />
_SubTabText.Add(drs(0)("Id") - 1, _SubText)<br />
Next<br />
Your problem is that Resh & Gani are not added to HashTable.
Are you sure that Resh and Gani are included in ts.TabText or dt?
Are you getting some errors in adding?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
Hello guys.
I have a date\time field from my Access database (ie 1983/09/20) and I need to extract that and check if its today.If the month and day correspond with today then I wana print all those people's details and a happy birthday message.
I knw this is a crap code but Im clueless on this one
Dim comx As New OleDbCommand
Dim conx As New OleDbConnection
conx = New OleDbConnection("Provider = Microsoft.Jet.oledb.4.0; data source = C:\Documents and Settings\kagisho.mashiloane\My Documents\Visual Studio 2005\Projects\Search AL\TelephoneList.mdb")
conx.Open()
'Tell the command which values to pull/get
comx = New OleDbCommand("Select * from Bithdays where BirthDate = " & Today.Date, conx)
comx.Connection = conx 'enure that the com
Please help guys.Thanx in advance.I jus wana compare the day and month to today.
kagiso
|
|
|
|
|
|
I have my database in MS Access and not sql.Im only looking to check if the day and month are the same as the sytem month and day.(yyyy/mm/dd), so Im only using the mm/dd.
Thanx in advance.
kagiso
|
|
|
|
|
matjame wrote: mm/dd.
Hi,
if you are saving mm/dd in yr database then you can check using like operator.
SELECT *
FROM testbl
where myDate like '9/12'
It will give all data containing date "9/12". You just have to pass current date and month in the query.
Thanks,
Sun Rays
|
|
|
|
|
Microsoft Access doesnt seem to support "LIKE", and by the way, the date in my database is saved in this format (yyyy/mm/dd).
Im getting errors running this.It doesnt seem to understand LIKE.
Thanx again.
kagiso
|
|
|
|
|
matjame wrote: Microsoft Access doesnt seem to support "LIKE", and by the way, the date in my database is saved in this format (yyyy/mm/dd).
Im getting errors running this.It doesnt seem to understand LIKE.
Hi,
I have checked in MsAccess itself.
its working fine. as yr format is (yyyy/mm/dd).
Then you have to change the query.
SELECT * FROM testbl<br />
where myDate like '*/9/12'<br />
Thanks,
Sun Rays
|
|
|
|
|
Syntax error (missing operator) in query expression 'BirthDate LIKE '*/09/20' 2007/11/13'.
comx = New OleDbCommand("Select * from Bithdays where BirthDate LIKE '*/09/20' " & Date.Today, conx)
comx.Connection = conx 'enure that the command follows the rite connection
If conx.State = ConnectionState.Open Then
conx.Close()
End If
conx.Open()
Dim datar As OleDbDataReader = comx.ExecuteReader
Error appears on the above statement
kagiso
|
|
|
|
|
matjame wrote: Syntax error (missing operator) in query expression 'BirthDate LIKE '*/09/20' 2007/11/13'.
comx = New OleDbCommand("Select * from Bithdays where BirthDate LIKE '*/09/20' " & Date.Today, conx)
comx.Connection = conx 'enure that the command follows the rite connection
If conx.State = ConnectionState.Open Then
conx.Close()
End If
conx.Open()
Dim datar As OleDbDataReader = comx.ExecuteReader
Error appears on the above statement
Hi,
What are you doing here ????????
write query as below...
Select * from Bithdays where BirthDate LIKE '*/" + DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() "'"
Thanks,
Sun Rays
|
|
|
|
|
Syntax error in string in query expression 'BirthDate LIKE '*/13/11'.
error points here
GridView1.DataSource = cm.ExecuteReader(CommandBehavior.CloseConnection)
Dim con As New OleDbConnection
Dim str1 As String = "Provider = Microsoft.Jet.oledb.4.0; Data source =C:\Documents and Settings\kagisho.mashiloane\My Documents\Visual Studio 2005\Projects\Search AL\TelephoneList.mdb"
Dim cm As OleDbCommand
Dim str2 As String
con = New OleDbConnection(str1)
con.Open()
str2 = "Select * from Bithdays where BirthDate LIKE '*/" & DateTime.Now.Day.ToString() & "/" & DateTime.Now.Month.ToString()
cm = New OleDbCommand(str2, con)
GridView1.DataSource = cm.ExecuteReader(CommandBehavior.CloseConnection)
GridView1.DataBind()
kagiso
|
|
|
|
|
Howzit Sun Rays.
Here is how the problem was solved.
str2 = "select * from Bithdays WHERE (DATEPART('m', BDate)) = '" & Date.Today.Month & "' And (DATEPART('d', BDate)) = '" & Date.Today.Day & "'"
cm = New OleDbCommand(str2, con)
GridView1.DataSource = cm.ExecuteReader(CommandBehavior.CloseConnection)
GridView1.DataBind()
Thanx a million for your assistance
kagiso
|
|
|
|
|
hi
try with this query..
if i m not wrong then BirthDate is your table column name ..
select * from Tablename WHERE (DATEPART(month, BirthDate) = @mt) AND (DATEPART(day, BirthDate) = @dt)
set value of this both variable as u want
Jintal Patel
|
|
|
|
|
Ok, I tried and loved it but the problem is that the values I have to give it are system generated(i.e the day and month I get from the database are compared to the day and month from my machine) so I cant use that method.
But I tried to do this
str2 = "Select * from Bithdays where WHERE (DATEPART(month, BirthDate)) = " & Date.Today.Day & AND "(DATEPART(day, BirthDate) = " & date.Today.Month
But Im getting an error on "AND"
kagiso
|
|
|
|
|
your syntax is wrong near '" & Date.Today.Day ' for concat so correct syntax
Jintal Patel
|
|
|
|