|
You can use the following code:
<br />
lblDay.Text=Format(Now().Today, "dddd")<br />
|
|
|
|
|
Is it in C# or SQL?
In C#, use the DayOfWeek[^] property.
In T-SQL use DATEPART[^] to get the weekday part.
I hope this helps!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi all,
im having problems using a alias name to perform calculations in the select clause. My code is as follows:
SELECT<br />
<br />
CASE WHEN STK_SORT_KEY2 = 'TREND' THEN ([OD_UNITCST] * (1 - ISNULL(dbo.TrendDiscount.Discount, '0.32'))) ELSE 0 END as Expr2, <br />
[Expr2] / [OD_UNITCST] AS Expr11<br />
<br />
FROM...<br />
My question is how do use a field to store calculations which i can reference later in the select clause. I keep getting a Invalid name 'Expr2' error
Any ideas?
Thanks in advance,
|
|
|
|
|
I think you need to enter the full calculation for your Expr11 field. I don't think you can refer to it by the alias.
|
|
|
|
|
Hi,
I'm using a OleDbDataReader to get values from a MS Access db.
I've noticed that if the db field is "null" I get an error, so I
put in: myReader.IsDBNull (see code below). Is there a better way to code this null value protection? (besides forcing no nulls in db)
- working with C#
while (myReader.Read())
{
if (myReader.IsDBNull(0) == false
cost = myReader.GetDecimal(0);
}
thanks,
Ron
|
|
|
|
|
what u used is the best method one more thing u can do ie cast the result to string now no error will come but its not correct. checking for null values and then assigning is the proper usage
VMSSanthosh
|
|
|
|
|
|
Hi
We have a MySql database (A) on a Linux machine and a MS Access database (B) on a windows machine. One of the tables in each of these two databases must be synchronised constantly. In A new records are added but no other modifications to records are done. In B records can be added, modified or deleted. At the moment we are trying a C# application that constantly compares the two tables by loading them in a dataset and basically comparing them record by record. I do not think this is very accurate and efficient.
Does anybody have ideas for us? It will really be greatly appreciated.
Kobus
|
|
|
|
|
One thing that comes to mind is the possibility of adding the MySql table to your Access database as an ODBC linked table. You could then, within Access, create a query that outer joins the two tables such that you can identify the records which exist in one but not the other... with a single INSERT query then you can bulk add all those records.
You could do something similar to look for records that have been modified.
|
|
|
|
|
iam generating a crystal report using VB 6.0 SQL server 2000 and crystal report 8.0 the stored procedure iam using is working fine the report is also working when i opened it in crystal report but when i run the application before generating report it shows an error "ERROR DETECTED BY DATABASE DLL" what is it?
|
|
|
|
|
Hi:
How can i can connect to an oracle Server in visual studio 2005?
thanks
|
|
|
|
|
Use the appropriate connection string for your Oracle server?
Your question is vague - are you having a specific problem connecting? are you getting an exception when you connect?
|
|
|
|
|
How can i store a text file at clients machine in asp.net
Amit
|
|
|
|
|
try this..................
Public Function DownLoadMyFile(ByVal sPath As String, ByVal sName As String)
Try
'If chkInOut.Checked = False Then
Dim pstrFilePath As String
pstrFilePath = sPath
If IO.File.Exists(pstrFilePath) Then
Dim myFileInfo As IO.FileInfo
Dim StartPos As Long = 0, FileSize As Long, EndPos As Long
myFileInfo = New IO.FileInfo(pstrFilePath)
FileSize = myFileInfo.Length
EndPos = FileSize
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
Dim Range As String = HttpContext.Current.Request.Headers("Range")
If Not ((Range Is Nothing) Or (Range = "")) Then
Dim StartEnd As Array = Range.Substring(Range.LastIndexOf("=") + 1).Split("-")
If Not StartEnd(0) = "" Then
StartPos = CType(StartEnd(0), Long)
End If
If StartEnd.GetUpperBound(0) >= 1 And Not StartEnd(1) = "" Then
EndPos = CType(StartEnd(1), Long)
Else
EndPos = FileSize - StartPos
End If
If EndPos > FileSize Then
EndPos = FileSize - StartPos
End If
HttpContext.Current.Response.StatusCode = 206
HttpContext.Current.Response.StatusDescription = "Partial Content"
HttpContext.Current.Response.AppendHeader("Content-Range", "bytes " & StartPos & "-" & EndPos & "/" & FileSize)
End If
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" & sName)
HttpContext.Current.Response.WriteFile(Server.HtmlEncode(pstrFilePath), StartPos, EndPos)
HttpContext.Current.Response.End()
End If
Catch ex As OleDb.OleDbException
Throw
Catch ex As Exception
Throw
End Try
End Function
VMSSanthosh
|
|
|
|
|
For clarification, your code doesn't have direct access to the clients machine. You have to send the file in something that the client would have to OK the download of and pick the spot to save it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi
my friend has installed sql server2000 with windows authentication. now he is finding problem in doing connectivity with it.what to be do.Is he has have to reinstalled it or is there some other method to do the connectivity.well do reply soon.
the error is something like "Illegal sql server authentication". thanks in advance.
nauty
|
|
|
|
|
nauty wrote: now he is finding problem in doing connectivity with it
Can you explain detail about the problem or the description of the message box?
Let do this case but you need to run on windows xp pro or win2k pro:
1. Log on as administrator mode.
2. Install sql server 2000.
3. Install MSDE 2000. MSDE could obtain from Microsoft download center.[^]
4. Open your sql server 2000 via Enterprise manager shortcut command in Microsoft sql server program folder.
5. Check the connection string.[^]
|
|
|
|
|
Roath Kanel wrote: 3. Install MSDE 2000. MSDE could obtain from Microsoft download center.[^]
WHAT???? Why? SQL Server is already installed!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I used to install sql server 2000 on windows xp pro. Whether sql server is running but i could not access to database. I also could not find server registration. But after i install MSDE from office xp pro CDROM. Then i could be able to access to database.
|
|
|
|
|
Hmmm... I had no problem at all. Limited number of connections due to XP's licensing limits, but it works fine, without using MSDE.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave, I will e-mail to you with attachment which show you about the problem since the time that i used to install sql 2000 before. I also wonder about the problem too but never post the question to the forum because i could run sql after i install msde. The attachment will include the screenshot to explain about each step.
|
|
|
|
|
Hi,
I am having date format problem with asp & mssql. Please help!
consider a table below
id dt
-- ---
1 2006-02-01 00:00:00.000
In the webform create 1 textbox & 1 button
User type a date in the textbox (format "dd/MM/yyyy hh:mm:ss tt" for example 28/02/2006)
In the button click event, write the update command to update the date with the textbox value in the 1st record.
Now the record should look like as below
id dt
-- ---
1 2006-02-28 00:00:00.000
The updated date can be displayed in a label or by using response.write as below
response.write(format(ds.tables("dt").rows(0).item(1),"dd/MM/yyyy hh:mm:ss tt"))
Please give me the code to implement these functions. I think the details given by me are sufficent and you understand my problem. I already posted regarding this problem but i can't able to rectify the problem. Please reply as soon as possible with the working solution.
Thanks in advance
|
|
|
|
|
dansoft wrote: write the update command to update the date with the textbox value in the 1st record.
And the code you've written for this is??? It's kind of impossible to tell you what you're doing wrong if you don't show us what you're doing to perform this update!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: show us what you're doing to perform this update!
User type a date in the textbox (format "dd/MM/yyyy hh:mm:ss tt" for example 28/02/2006)
I want the update command to update the date in the 1st record.
str="update test set dt='" & txtDt.text & "'" & "where id=1"
I don't know how to format that date in text box while updating. Because the user enter date in "dd/MM/yyyy hh:mm:ss tt" format. Please give me the code for implement this kind of update.
Now the record should look like as below
id dt
-- ---
1 2006-02-28 00:00:00.000
Thanks
|
|
|
|
|
First, why are you having the user type all that junk in when you're only using the date?
Next, don't use string concatentation to build SQL queries. You open yourself up to SQL Injection attacks and it just makes your job that much harder when you're trying to debug problems.
Use SqlParameters to do this. It'll format the date for you if you parse the textbox string into a DateTime object first.
Learn to pass parameters correctly before you get into the habit of doing it the wrong way. SQL Injection Attacks and How to Prevent Them[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|