|
Now i am in a condition, Where I am just displaying the month names and numbers. There is a small issue. I need to get month names instead of month numbers from Oracle.
here's my query
SELECT Count(*),EXTRACT (MONTH FROM DATE_CREATED),EXTRACT (YEAR FROM DATE_CREATED) FROM MyTable GROUP BY EXTRACT (YEAR FROM DATE_CREATED) ,EXTRACT (MONTH FROM DATE_CREATED)
And the result is 3 columns. Count, Month(Number) and year
something like this
3 10 2006
Please anyone help to convert the month number to month name in oracle or C#. Problem is I cannot use the data formatting functions as this is a single number appearing.
Thanks for any help!!!!!!!!!!!!!!!
|
|
|
|
|
I got my soluin...i posting it here for someone who may need it!!!!!!!!!!!!!!
Select count(*), EXTRACT (MONTH FROM DATE_CREATED),to_char(date_created,'MONTH')month_created FROM MyTable WHERE EXTRACT (YEAR FROM DATE_CREATED) = '2007' GROUP BY EXTRACT (MONTH FROM DATE_CREATED) ,to_char(date_created,'MONTH')
|
|
|
|
|
You mean the ON DELETE SET NULL option in SQL 2005? I don't think there is an equivalent in Access. You should probably run an UPDATE query on your foreign key field before your DELETE query to set any values related to this picture to NULL.
Paul Marfleet
|
|
|
|
|
please have a look to my code.I always have error invalid user name or passwprd , can you help me please.if oyu want me to send you the whole project please let me know.
private void Page_Load(object sender, System.EventArgs e)
{
}
private static string CreateSalt(int size)
{
// Generate a cryptographic random number using the cryptographic
// service provider
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] buff = new byte[size];
rng.GetBytes(buff);
// Return a Base64 string representation of the random number
return Convert.ToBase64String(buff);
}
private static string CreatePasswordHash(string pwd, string salt)
{
string saltAndPwd = String.Concat(pwd, salt);
string hashedPwd =
FormsAuthentication.HashPasswordForStoringInConfigFile(
saltAndPwd, "SHA1");
hashedPwd = String.Concat(hashedPwd, salt);
return hashedPwd;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.btnLogon.Click += new System.EventHandler(this.btnLogon_Click);
this.btnRegister.Click += new System.EventHandler(this.btnRegister_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnRegister_Click(object sender, System.EventArgs e)
{
int saltSize = 5;
string salt = CreateSalt(saltSize);
string passwordHash = CreatePasswordHash(txtPassword.Text,salt);
try
{
StoreAccountDetails( txtUserName.Text, passwordHash);
}
catch(Exception ex)
{
lblMessage.Text = ex.Message;
}
}
private bool VerifyPassword(string suppliedUserName,
string suppliedPassword )
{
bool passwordMatch = false;
// Get the salt and pwd from the database based on the user name.
SqlConnection conn = new SqlConnection( "Server=(local);" +"Integrated Security=SSPI;" + "database=UserAccounts");
SqlCommand cmd = new SqlCommand( "LookupUser", conn );
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter sqlParam = cmd.Parameters.Add("@userName",
SqlDbType.VarChar,
20);
sqlParam.Value = suppliedUserName;
try
{
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read(); // Advance to the one and only row
// Return output parameters from returned data stream
string dbPasswordHash = reader.GetString(0);
int saltSize = 5;
string salt =
dbPasswordHash.Substring(dbPasswordHash.Length - saltSize);
reader.Close();
// Now take the password supplied by the user
// and generate the hash.
string hashedPasswordAndSalt =
CreatePasswordHash(suppliedPassword, salt);
// Now verify them.
passwordMatch = hashedPasswordAndSalt.Equals(dbPasswordHash);
}
catch (Exception ex)
{
throw new Exception("Execption verifying password. " +
ex.Message);
}
finally
{
conn.Close();
}
return passwordMatch;
}
private void StoreAccountDetails( string userName,
string passwordHash )
{
// See "How To Use DPAPI (Machine Store) from ASP.NET" for information
// about securely storing connection strings.
SqlConnection conn = new SqlConnection( "Server=(local);" + "Integrated Security=SSPI;" +
"database=UserAccounts");
SqlCommand cmd = new SqlCommand("RegisterUser", conn );
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter sqlParam = null;
//Usage of Sql parameters also helps avoid SQL Injection attacks.
sqlParam = cmd.Parameters.Add("@userName", SqlDbType.VarChar,
20);
sqlParam.Value = userName;
sqlParam = cmd.Parameters.Add("@passwordHash ", SqlDbType.VarChar,
40);
sqlParam.Value = passwordHash;
try
{
conn.Open();
cmd.ExecuteNonQuery();
}
catch( Exception ex )
{
// Code to check for primary key violation (duplicate account
// or other database errors omitted for clarity
throw new Exception("Exception adding account. " + ex.Message);
}
finally
{
conn.Close();
}
}
private void btnLogon_Click(object sender, System.EventArgs e)
{
bool passwordVerified = false;
try
{
passwordVerified =
VerifyPassword(txtUserName.Text,txtPassword.Text);
}
catch(Exception ex)
{
lblMessage.Text = ex.Message;
return;
}
if (passwordVerified == true )
{
lblMessage.Text = "Logon successful: User is authenticated";
}
else
{
lblMessage.Text = "Invalid username or password";
}
}
|
|
|
|
|
insert below code to your page load method:
**************
if(!IsPostBack)
{
//your special code that must be run for first time in loading of page
//if you have not any code for here so leave empty.
}
**************
try it...hope to successfully.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
|
Hi all,
my project is based on inserting and retrieving video files (type :MPEG)
I'm using ASP.NET2.0 and SQL SERVER 2005
my question is how can I insert video files in the database????
bleave in your self
|
|
|
|
|
This question has nothing to do with ASP.NET. The ASP.NET part would be 'how do I upload video files'. You realise that unless you serve the video files without any other HTML, you can't serve them from the database ? It's probably better to store the path to a video on your file system. Having said that, you can store them as a blob.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi friend's
how can i access to the selected value property of a dropdownlist control with javascript?
as you know dropdownlist is a server control
although,i know a method that allow me to access a property of a server control such as checkbox or optionbox but this method doesn't work for drop downlist:
============================================================================
var chk_MainUser=document.getElementById('<%= rb_Users.ClientID %>');
alert(chk_MainUser.getAttribute("checked"));
============================================================================
if you know a technique for it please tell me...
thank you.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
mr.mohsen wrote: i know a method that allow me to access a property of a server control such as checkbox or optionbox
No, you don't. You can't access any server control at all from Javascript. The code is accessing the html elements that the server control has rendered.
The server controls only exist on the server to create the html page. Once the page is created and sent to the browser, the server controls doesn't exist any more.
mr.mohsen wrote: how can i access to the selected value property of a dropdownlist control with javascript?
You can't. You have to access the properties of the html elements that the control has rendered. Use the selectedIndex property to get the index of the selected item, then use that to get the value of the selected item.
Example:
var sel = document.getElementById('idOfTheSelectElement');<br />
var value = sel.options[sel.selectedIndex];
---
single minded; short sighted; long gone;
|
|
|
|
|
thank you Guffa
befor i test your code i want to ask you about the realation of server and client:
i want to call a javascript function from server-side,it means when my page is loading,i want to call a specific function(javascript function).how can i do it?do you know?
thank you for your answer.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
When your server side code generates the script for the page, it can generate script to call the method in question when the page loads.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I have a asp:CompleteWizardStep after creating my user. When registration reaches this step there is a continue button. How do not have the continue button to be there, I don't want it there at all. I just want a thank you message. Also, the continue button is to the right, how do I have it left aligned because my asp:CreateUserWizard has a width of a 100%.
Please can someone help??
Regards
|
|
|
|
|
this small side from the problem if iput this code in code behind of asp page
protected void Page_Load(object sender, EventArgs e)
{
Image1.ImageUrl = Server.MapPath(@"images/1.jpg");
Image1.DataBind();
}
it will work in microsoft internet explorer and won't work in opera and firefox???
any body can help???
|
|
|
|
|
When you run in IE, View the page source of IE see the path of that image.
and then as per that path you need to set in code like.
./images/1.jpg like that.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Hello friends, I am new to vs 2005. I created a site using vs 2005 and sql server 2005. I publish my site locally - it runs, but when i upload it to a web server it gives following error...What went wrong? Can any1 help me?
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load the assembly 'App_Web_fwbn44me'. Make sure that it is compiled before accessing the page.
Source Error:
Line 1: <%@ page language="C#" autoeventwireup="true" inherits="_Default, App_Web_fwbn44me" enableEventValidation="false" viewStateEncryptionMode="Never" %>
Line 2:
Line 3: <%@ Register Src="Bottom.ascx" TagName="Bottom" TagPrefix="uc2" %>
Source File: /test/test/Default.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
|
|
|
|
|
hi , i have build an ASP.net application using Enterprise library 1.1. Curremtly i was using sql server 2000. Now i have to take my DB to sql server 2005. my question is that my current application will work with SQL server 2005??? Is enterprise library 1.1(june 2005) work well with SQL server 2005????? please reply soon...
|
|
|
|
|
You've asked this in two forums. The other one is the right one. What DB you use has nothing to do with ASP.NET. Your app should work fine, but you should run your unit tests to be sure, because there are changes to T-SQL, and you never now for sure.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i was confused because i used enterprise library 1.1(june 2005) and was not sure that will it work with sql server 2005. thnx for reply
|
|
|
|
|
hi
in one of my webform's project , user can select some choice from a list.
after each select, that item insert into a temp table in my database. and ...
at last ,if user click ok button ,all selected things insert into main table.
if page closed or exit with any reason before user click ok or cancel button , in code temp table must be clear.
my problem is can not find any thing such as an event for times when user exit from the page.
how can recognize in asp.net when user exit from a page ?
tanks
|
|
|
|
|
In ASP.NET, you can't, but you can write AJAX code that sends a message to the server when the browser is closed, and of course you can integrate this into your ASP.NET project, although it won't use any ASP.NET libraries or code behind ( unless you choose to emit your script in your code behind ).
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
tanks.
exactly this solution was in my mind.
and now found is right
|
|
|
|
|
To handle the Browser close event you will have to write a javascript function that handles it and call the function on the OnBeforeUnload client event.
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
I'm using ACCESS 2000 and i make a connection to dreamweaver 2004.
heres the code:
<configuration>
<appsettings>
<add key="MM_CONNECTION_HANDLER_conn" value="default_oledb.htm">
<add key="MM_CONNECTION_STRING_conn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\sample\data\data.mdb;User ID=;Password=">
<add key="MM_CONNECTION_DATABASETYPE_conn" value="OleDb">
<add key="MM_CONNECTION_SCHEMA_conn" value="">
<add key="MM_CONNECTION_CATALOG_conn" value="">
I click the test connection and its okay. My problem is when I check my table there no any record. Could somebody help me
|
|
|
|
|
Hard to say based on the half snippet you offer here. What makes you feel you should be getting something back ? What does your code look like ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|