15,895,084 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 MahmoudOmar (Top 46 by date)
MahmoudOmar
12-Dec-17 5:51am
View
Datetime just i save data like : 1, xxxx, 10-5-2017, 30-5-2017 and i wand select between this two date using linq
MahmoudOmar
7-Dec-17 4:17am
View
ok, how i crypt value and decrypt
MahmoudOmar
10-Nov-17 8:03am
View
Generic failed
MahmoudOmar
26-May-17 8:38am
View
this is error that show me general failure
MahmoudOmar
26-May-17 8:21am
View
how i get the error from ajax or print it, anyway subCategoryList return value but i get error
MahmoudOmar
28-Mar-17 15:12pm
View
i don't know. i don't get any error and it's not working , class here don't work :-
@Html.TextBoxFor(model => model.VisiteDate, new { @class = "form-control datepicker ", placeholder = "Enter Date" })
@Html.ValidationMessageFor(model => model.VisiteDate)
MahmoudOmar
26-Mar-17 15:43pm
View
it's Primary Key but i don't make it identity , but when i used query string its worked. why i don't know !!!
this is Edite Code:-
[AuthorizeRole(nameof(CenterTechnical), nameof(Create))]
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(/*[Bind(Include = "ID, LocationCenterID, TechName, TechMobile, TechPhone, TechAddress")]*/CenterTechnical centerTechnical)
{
if(ModelState.IsValid)
{
string constr = ConfigurationManager.ConnectionStrings["WhiteWhaleModel"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
string query = " INSERT INTO CenterTechnical(ID, LocationCenterID,TechName,TechMobile,TechPhone,TechAddress) ";
query = query + " VALUES(@ID, @LocationCenterID, @TechName, @TechMobile, @TechPhone, @TechAddress) ";
using (SqlCommand cmd = new SqlCommand(query))
{
cmd.Connection = con;
con.Open();
cmd.Parameters.AddWithValue("@ID", centerTechnical.ID);
cmd.Parameters.AddWithValue("@LocationCenterID", centerTechnical.LocationCenterID);
cmd.Parameters.AddWithValue("@TechName", centerTechnical.TechName);
cmd.Parameters.AddWithValue("@TechMobile", centerTechnical.TechMobile);
cmd.Parameters.AddWithValue("@TechPhone", centerTechnical.TechPhone);
cmd.Parameters.AddWithValue("@TechAddress", centerTechnical.TechAddress);
cmd.ExecuteNonQuery();
con.Close();
}
}
//var newTechnical = new CenterTechnical()
//{
// ID = centerTechnical.ID,
// LocationCenterID = centerTechnical.LocationCenterID,
// TechName = centerTechnical.TechName,
// TechMobile = centerTechnical.TechMobile,
// TechPhone = centerTechnical.TechPhone,
// TechAddress = centerTechnical.TechAddress
//};
//db.CenterTechnical.Add(newTechnical);
//db.SaveChanges();
return RedirectToAction("Index");
}
else
{
return View(centerTechnical);
}
}
MahmoudOmar
26-Mar-17 14:28pm
View
Why when i write number Like 2 in textboxFor ID its give me This error?
MahmoudOmar
26-Mar-17 14:27pm
View
Deleted
Why when i write number Like 2 in textboxFor ID its give me This error?
MahmoudOmar
6-Mar-17 14:31pm
View
i need solve this error and i don't know how i solve it
MahmoudOmar
12-Feb-17 4:22am
View
i solve my problem and this code work thanks for help
MahmoudOmar
12-Feb-17 3:49am
View
i write :-
var email = (string)Session["email"];
and i edit in LocationCenterIDs :-
var LocationCenterIDs = (from ulc in db.UserLocationsCenter join asp in db.AspNetUsers on ulc.UserID equals asp.Id where asp.Email == email select ulc.LocationCenterID);
var result = db.ClientsNotifications.Where(k => LocationCenterIDs.Contains(k.LocationCenterID)).OrderByDescending(k => k.UploadDate).ToList();
return View(result);
and give me this Error :-
An error occurred while executing the command definition. See the inner exception for details.
MahmoudOmar
8-Feb-17 1:14am
View
ty i solved my error , i found error in clientsnotifications model , in this line public string ClientId { get; set; } and i change clientid to clientcode and its work
MahmoudOmar
7-Feb-17 5:56am
View
An exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
this is massage but i don't know what is user code how i solve this error
MahmoudOmar
6-Jan-17 17:18pm
View
thanks man i get my problem and i solve it thank you for help
MahmoudOmar
25-Dec-16 7:42am
View
the correct name is PROF_TASKS and i will edit it but i have the same error
MahmoudOmar
25-Dec-16 3:20am
View
i want make the format date is complete like 01/10/2016 how i do that
MahmoudOmar
2-Oct-16 10:17am
View
error is connot convert byte to byte[] how i get the value i am new and i learn so help please
MahmoudOmar
27-Sep-16 17:37pm
View
i do it but i have the same error, can you help me
MahmoudOmar
27-Sep-16 17:10pm
View
the port is 1433 in TCP Port ,but how i can make firewall allow the port and how i know its allowed?
MahmoudOmar
30-Aug-16 6:29am
View
thanks its Correct and its working now
MahmoudOmar
30-Aug-16 4:44am
View
First :- Its multiple column not 2 column its just example,
second :- i don't find radio button in grid view column type so i used checkbox
MahmoudOmar
30-Aug-16 3:09am
View
i have two column in gridview this column it's checkbox like that,
Drivers Name , Absence, vacation
------------ ------- --------
Name1 1 0
Name2 0 1
Name3 1 0
Name4 1 0
i want when i check in Absence the vacation became false , and when i check vacation the absence became false.
How i do that.
please tell me if you don't understand me.
MahmoudOmar
30-Aug-16 2:35am
View
i have two column in gridview this column it's checkbox like that,
Drivers Name , Absence, vacation
------------ ------- --------
Name1 1 0
Name2 0 1
Name3 1 0
Name4 1 0
i want when i check in Absence the vacation became false , and when i check vacation the absence became false.
How i do that.
please tell me if you don't understand me.
MahmoudOmar
20-Aug-16 6:24am
View
thanks i found my error and it's working know :)
MahmoudOmar
20-Aug-16 6:13am
View
How i pass this parameter to form login, because i do that but it's not working
MahmoudOmar
18-Aug-16 4:37am
View
windows application not asp.net
MahmoudOmar
16-Aug-16 9:05am
View
ok and thanks
MahmoudOmar
16-Aug-16 8:55am
View
user_name(), its save user in sql , i want save user who login in the program.
MahmoudOmar
15-Aug-16 2:57am
View
thanks its work trigger delete its the same way or what? and thanks
MahmoudOmar
11-Aug-16 5:31am
View
i want instead of update the row from c# application the date insert into table that i created that is i want
MahmoudOmar
7-Aug-16 9:12am
View
it's work thanks, but i have new problem when i click on the button Log Out the insert happen twice because compiler insert to FRM_Main_FormClosing Event handler. too how i stop it and thanks
MahmoudOmar
1-Aug-16 6:50am
View
thanks it's working
MahmoudOmar
27-Jun-16 4:48am
View
debugger, It is not clear to me anything
MahmoudOmar
22-Jun-16 8:32am
View
please i need videos or link for help and thanks
MahmoudOmar
22-Jun-16 8:11am
View
i create gridview in form and i add columns from this grid.
i want pass select query with this columns that i created in this grid how i do that ?
MahmoudOmar
15-Jun-16 8:13am
View
dtP_Date.Value = sdReader.GetDateTime(1);
MahmoudOmar
15-Jun-16 6:55am
View
its working in sql query but i have error in code C# app :- Specified cast is not valid.
this is code :-
s = s + " ;with q as ( select Car_id, MAX(Change_date) as 'Max date', MAX(Current_dist) as 'Current dist' from Tashhem group by Car_id ) ";
s = s + " SELECT q.Car_id, q.[Max date], s1.Current_dist as 'Current dist' , s1.Driver_ID from q ";
s = s + " INNER JOIN Tashhem s1 on q.Car_id=s1.Car_id AND q.[Max date]=s1.Change_date ";
s = s + " INNER JOIN Tashhem s2 on q.Car_id=s2.Car_id AND q.[Current dist]=s2.Current_dist ";
s = s + " where q.Car_id = @car_id ";
sCommand = new SqlCommand(s, con);
sCommand.Parameters.AddWithValue("@car_id", txt_Car_id.Text);
sdReader = sCommand.ExecuteReader();
if (sdReader.Read())
{
dtP_Date.Value = sdReader.GetDateTime(1);
txt_Prev_dist.Text = sdReader.GetString(2);
CB_Driver_name.SelectedValue = sdReader.GetString(3);
txt_Car_id.ReadOnly = true;
}
MahmoudOmar
15-Jun-16 5:01am
View
i want select max date and max current_dist each car_id
MahmoudOmar
15-Jun-16 4:45am
View
this query must be display this result:-
555 | 2016-03-09 | 12000 | 4
MahmoudOmar
15-Jun-16 4:44am
View
no he stops working i don't know why ,even though the query is correct?
MahmoudOmar
12-Jun-16 5:35am
View
its not working
MahmoudOmar
11-Jun-16 6:42am
View
its working, thank you
MahmoudOmar
5-Jun-16 3:14am
View
i try do this and it's working but i have same problem :-
protected void insertdata_Click(object sender, EventArgs e)
{
OleDbConnection oledbConn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("test4.xlsx") + ";Extended Properties=Excel 12.0;");
try
{
OleDbCommand ocmd = new OleDbCommand("select [Notifications],[ReqStart],[Type],[ReqTime],[OrderNum],[FuncLoc],[CustomerCode],[CustomerName],[Rg],[city],[Phone],[Street],[Distrit] from [Sheet1$]", oledbConn);
oledbConn.Open();
OleDbDataReader odr = ocmd.ExecuteReader();
string Notifications = "";
string ReqStart = " ";
string Type = " ";
string ReqTime = " ";
string OrderNum = " ";
string FuncLoc = " ";
string CustomerCode = " ";
string CustomerName = " ";
string Rg = " ";
string city = " ";
string Phone = " ";
string Street = " ";
string Distrit = " ";
while (odr.Read())
{
Notifications = valid(odr, 0);
ReqStart = valid(odr, 1);
Type = valid(odr, 2);
ReqTime = valid(odr, 3);
OrderNum = valid(odr, 4);
FuncLoc = valid(odr, 5);
CustomerCode = valid(odr, 6);
CustomerName = valid(odr, 7);
Rg = valid(odr, 8);
city = valid(odr, 9);
Phone = valid(odr, 10);
Street = valid(odr, 11);
Distrit = valid(odr, 12);
insertdataintosql(Notifications, ReqStart, Type, ReqTime, OrderNum, FuncLoc, CustomerCode, CustomerName, Rg, city, Phone, Street, Distrit);
}
oledbConn.Close();
}
catch(DataException ex)
{
lblmssg.Text = ex.Message;
lblmssg.ForeColor = System.Drawing.Color.Red;
}
finally
{
lblmssg.Text = "Data Inserted Sucessfully";
lblmssg.ForeColor = System.Drawing.Color.Green;
}
}
protected string valid(OleDbDataReader myreader, int stval)
{
object val = myreader[stval];
if (val != DBNull.Value)
{
return val.ToString();
}
else
{
return Convert.ToString(0);
}
}
public void insertdataintosql(string Notifications, string ReqStart, string Type, string ReqTime, string OrderNum, string FuncLoc, string CustomerCode, string CustomerName, string Rg, string city, string Phone, string Street, string Distrit)
{
SqlConnection sqlconn = new SqlConnection("Data Source=.;Initial Catalog=White_Whale;Integrated Security=True");
using (SqlCommand cmd=new SqlCommand())
{
cmd.Connection = sqlconn;
cmd.CommandText = "insert into Customers(customer_code,customer_name,RgCode,CityCode,Phone,Distriet,Street) values(@customer_code,@customer_name,@RgCode,@CityCode,@Phone,@Distriet,@Street)";
cmd.Parameters.Add("@customer_code", SqlDbType.VarChar, 20).Value = CustomerCode;
cmd.Parameters.Add("@customer_name", SqlDbType.VarChar, 100).Value = CustomerName;
cmd.Parameters.Add("@RgCode", SqlDbType.Int).Value = Convert.ToInt32(Rg);
cmd.Parameters.Add("@CityCode", SqlDbType.Int).Value = Convert.ToInt32(city);
cmd.Parameters.Add("@Phone", SqlDbType.VarChar, 12).Value = Phone;
cmd.Parameters.Add("@Distriet", SqlDbType.VarChar, 12).Value
MahmoudOmar
23-May-16 9:10am
View
this is RouteConfig.cs
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Auth", action = "Login", id = UrlParameter.Optional }
);
}
MahmoudOmar
23-May-16 7:41am
View
i create database in project and i add entity model ,
this is code that i change it in Authlogin Class,
public partial class AuthLogin
{
public int UserId { get; set; }
[Required(ErrorMessage = "Please enter your name")]
[Display(Name = "User Name")]
public string UserName { get; set; }
[Required(ErrorMessage = "Please enter your password")]
[Display(Name = "Password")]
[DataType(DataType.Password)]
public string Password { get; set; }
public bool CheckUser(string Username, string Password)
{
bool flag = false;
string conString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(conString))
{
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from AuthLogin where Username = '" + Username + "' and Password = '" + Password + "'", con);
flag = Convert.ToBoolean(cmd.ExecuteScalar());
return flag;
}
}
}
and code in controoler:-
public ActionResult Login()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login(AuthLogin login)
{
if(ModelState.IsValid)
{
if(login.CheckUser(login.UserName,login.Password))
{
return View("Notification", login);
}
else
{
ViewBag.Message = "Invalid Username or Password";
return View();
}
}
else
{
return View();
}
}
Show More