15,886,724 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by UDTWS (Top 27 by date)
UDTWS
15-Sep-22 16:29pm
View
Deleted
.
UDTWS
10-Apr-20 9:54am
View
if i want to check if faculty name already exists than how to solve this problem using store procedure. i am facing problem duplicate user while insert i want to stop duplicate user while insert.
Thanks in advance
UDTWS
10-Apr-20 9:50am
View
from two days i am try different different method to solve problem but still problem not solved. please check once again my code and help to resolve issue.
Thanks & Regards
UDTWS
9-Apr-20 18:33pm
View
Thanks for reply but still Problem not solved. Procedure or function 'spCreateUser' expects parameter '@result', which was not supplied. and i given another sp than duplicate user not entered but how message show that user already exists.
UDTWS
9-Apr-20 10:16am
View
i change in my store procedure as below
alter PROCEDURE spCreateUser
@userName varchar(20),
@pass varchar(30),
@email varchar(50),
@userRole int,
@userPhoto varchar(100),
@userStatus int
AS
IF (SELECT COUNT(*) FROM tbl_user WHERE userName= @userName) < 1
BEGIN
INSERT INTO tbl_user(userName,pass,email,userRole,userPhoto,userStatus)
VALUES(@userName,@pass,@email,@userRole,@userPhoto,@userStatus)
END
it works but if not insert value due to duplicate how mange error message in C# any method
UDTWS
9-Apr-20 9:57am
View
protected void btn_insert_Click(object sender, EventArgs e)
{
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
string path = string.Concat(Server.MapPath("~/UploadFile/" + fu_photo.FileName));
fu_photo.SaveAs(path);
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("spCreateUser", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("userName", txt_username.Text);
cmd.Parameters.AddWithValue("pass", txt_pass.Text);
cmd.Parameters.AddWithValue("email", txt_email.Text);
cmd.Parameters.AddWithValue("userRole", ddl_role.SelectedValue);
cmd.Parameters.AddWithValue("userPhoto", path);
cmd.Parameters.AddWithValue("userStatus", ddl_status.SelectedValue);
var result = cmd.Parameters.Add("@result", SqlDbType.Int);
returnParameter.Direction = ParameterDirection.ReturnValue;
con.Open();
int k = cmd.ExecuteNonQuery();
if (k != 0)
{
lblMsg.Text = "Record Inserted Succesfully into the Database";
lblMsg.ForeColor = System.Drawing.Color.CornflowerBlue;
}
con.Close();
}
now error is :-
The name 'returnParameter' does not exists in the current context.
UDTWS
9-Apr-20 9:53am
View
Procedure or function 'spCreateUser' expects parameter '@result', which was not supplied.
UDTWS
9-Apr-20 6:53am
View
i will store my password with encryption. and if not save in database than what should i do.
UDTWS
9-Apr-20 6:52am
View
Thanks for reply,
but this code is not working due to not know how exact i use this sp. got error message you not pass result.
UDTWS
22-Apr-19 0:39am
View
i am trying to pass value using postbackurl property of linkbutton. and hidden field value pass in another page. when i use this in new file working properly but where i really want to use not working their. for this any solution. even i try to pass static value from one page to another page in real page.
UDTWS
18-Apr-19 1:33am
View
Thanks for reply but i would like to send values on another page. is it possible that we send values from one page to another page using View State.
UDTWS
15-Apr-19 6:36am
View
is their any other process to pass values without using querysting or session.
UDTWS
15-Apr-19 6:36am
View
is their any other process to pass values without using querysting or session.
UDTWS
15-Apr-19 6:36am
View
is their any other process to pass values without using querysting or session.
UDTWS
2-Mar-15 22:27pm
View
no i create connection string using ur suggestion but i still problem not solved...
UDTWS
1-Mar-15 23:06pm
View
ya i use this and create connection with the help of this but still i got problem so please check my connection string and tell me where i am wrong..
thanks & regards
UDTWS
26-Jan-15 7:40am
View
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Security.Cryptography;
using System.Text;
using System.Configuration;
using System.Data;
public partial class admin_Default : System.Web.UI.Page
{
// string conStr = ConfigurationManager.ConnectionStrings("WebConn").ConnectionString;
SqlConnection conStr = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
}
public bool validation()
{
bool functionReturnValue = false;
if ((txtUserNm.Text.Trim().ToString()).Length <= 3 | (txtUserNm.Text.Trim().ToString()).Length > 10)
{
ltrlMsg.Text = "Enter correct Login ID";
var _with1 = txtUserNm;
if (_with1.Enabled & _with1.Visible)
_with1.Focus();
return false;
return functionReturnValue;
}
else if ((txtPassword.Text.Trim().ToString()).Length <= 3 | (txtPassword.Text.Trim().ToString()).Length > 10)
{
ltrlMsg.Text = "Enter correct Password";
var _with2 = txtPassword;
if (_with2.Enabled & _with2.Visible)
_with2.Focus();
return false;
//return functionReturnValue;
}
return true;
//return functionReturnValue;
}
public void infobox(string message)
{
string NewScript = null;
NewScript = "<script language=JavaScript>";
NewScript = NewScript + "alert('" + message + "');";
NewScript = NewScript + "</script" + ">";
if ((!ClientScript.IsClientScriptBlockRegistered("alert"))) {
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", NewScript);
}
}
private string md5(string sPassword)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(sPassword);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
return s.ToString();
}
protected void btnLogin_Click(object sender, EventArgs e)
{
if (validation() == true)
{
SqlCommand cmd = new SqlCommand();
string sql = "Select * from tblMN_Login where mnLoginId='" + txtUserNm.Text.Trim() + "'";
string pswd = null;
conStr.Open();
cmd.Connection = conStr;
cmd.CommandText = sql;
cmd.CommandType=System.Data.CommandType.Text;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
pswd=dr["mnPassword"].ToString();
if (pswd == md5(txtPassword.Text) )
{
ltrlMsg.Text = "";
Random rnd = new Random();
Session["authorise"] = rnd.Next(1000, 9999);
Session["LogId"] = txtUserNm.Text.Trim();
Session["UsrType"] = null;
if (Convert.ToInt32(dr["USER_TYPE"])== 11) {
Session["UsrType"] = 11;
Response.Redirect("SupLogin.aspx");
} else if (Convert.ToInt32(dr["USER_TYPE"]) == 27) {
Session["UsrType"] = 27;
Response.Redirect("MN_Login.aspx");
}
} else {
ltrlMsg.Text = "Wrong Password";
txtPassword.Focus();
}
} else {
ltrlMsg.Text = "Wrong Login ID";
txtUserNm.Focus();
}
if (conStr.State==System.Data.ConnectionState.Open)
conStr.Close();
}
}
}
UDTWS
26-Jan-15 2:02am
View
Thanks for reply but still i got this error message...
Server Error in '/' Application.
WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).]
System.Web.UI.ClientScriptManager.EnsureJqueryRegistered() +2170706
System.Web.UI.WebControls.BaseValidator.RegisterUnobtrusiveScript() +10
System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +9576593
System.Web.UI.Control.PreRenderRecursiveInternal() +83
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Control.PreRenderRecursiveInternal() +168
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
UDTWS
4-Nov-14 3:14am
View
Thanks for reply but still i got same error
UDTWS
4-Nov-14 2:21am
View
Thanks for reply
as you given solution i real a lot but i did not get answer so plz tell me that on my local host work properly but when i upload i got this error message and debug or do a lot will you explain what is the problem
Thanks & REgards
UDTWS
12-Oct-14 23:06pm
View
Thanks for reply and ya i know it but i just do it once to create database after that that page will be removed from server. plz tell me if any process thanks & regards
UDTWS
12-Oct-14 23:03pm
View
Thanks to reply but Mr.Wes Aday please understand my question first
UDTWS
11-Jul-13 5:20am
View
Thanks for reply,
but i got an error msg like this DBNull is a type and cannot be used as an expression
UDTWS
11-Jul-13 5:18am
View
Thanks for reply, i try this code to convert into string in if but error msg Conversion from string "" to type 'Bolean' is not valid
UDTWS
11-Oct-12 23:53pm
View
Thanks for solution. now i would like to know how i can close some toolbars.
Thanks again.
UDTWS
8-Oct-12 3:03am
View
Sir i solve the problem and now file is uploading and i need work is done. is this write way to do this type of work. i want to know only that i am going to right direction or not. i think that my coding is too much poor.
Thanks for reply.
REgards
Umesh Daiya
UDTWS
30-Sep-12 5:23am
View
Thanks For Reply: but plz check this
showimage.ashx
<%@ WebHandler Language="C#" Class="showimage" %>
using System;
using System.Web;
using System.Data.SqlClient;
public class showimage : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
//establish the data connection
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["CONN_STRING"].ConnectionString))
{
//get the image through newsid passed as querystring
SqlCommand command = new SqlCommand("Select news_image from tbl_news where news_id = '" + context.Request.QueryString["newsid"] + "'", connection);
connection.Open();
SqlDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
if (dr["news_image"].ToString().Length > 0)
{
context.Response.BinaryWrite((byte[])dr["news_image"]);
}
}
}
}
}
default.aspx
<pre lang="xml"><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
BorderWidth="0" BorderColor="White" ShowHeader="False" Width="100%">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink runat="server" ID="hl" NavigateUrl='<%#"NewsDetails.aspx?Newsid="+ Eval("news_id") %>' Text='<%# Eval("news_title") %>'></asp:HyperLink>
<img id="imgTest" src="showimage.ashx?newsid=<%# Eval("news_id=") %>" width="100px" height="100px" title="<%# Eval("news_title") %>" />
</img>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView></pre>
i do this as you suggested is it right. but i have got a error message "Error 26 showimage does not implement interface member System.Web.IHttpHandler.IsReusable.
"
now what i should do to correct this i use first time this handler i did not know about it more.
Show More