|
List<users> lstusers = new List<users>();
lstusers = AMSManagement.GetAllUsers();
var lnquser = from u in lstusers
where u.User_ID == int.Parse(Session["UserID"] == null ? "0" : Session["UserID"].ToString())&& u.Pass_word==txtopwd.Text.Trim()
select u;
if (lnquser.ToList().Count > 0)
{
users u = new users();
u.User_ID = int.Parse(Session["UserID"].ToString());
u.Pass_word = txtcnpwd.Text.Trim();
AMSManagement.Changepassword(u);
lblmsg.Text = "Password Changed Successfully!";
}
else
{
lblmsg.Text = "plz enter valid old password!";
}
when i change code as your view then it execute else part
|
|
|
|
|
Could you please debug and check the value of Session["UserID"]
I think Session["UserID"] is not initiated.
|
|
|
|
|
|
Could you please post the code where are you setting the value of Session["UserID"]?
|
|
|
|
|
public int User_ID { set; get; }
public string UserID { set; get; }
public string Pass_word { set; get; }
public string UserType { set; get; }
|
|
|
|
|
you need to check the value of the UserID
string UserID = Session["UserID"].ToString();
I would put this before the LinQ statement and put a breakpoint on it, step over that line and then see what if any value UserID holds. So change your code to
string UserID = Session["UserID"].ToString();
var Inquser = from u in lstusers where u.User_ID == int.Parse(Session["UserID"].ToString()) && u.Pass_word == txtopwd.Text.Trim();
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Try this instead:
int userId;
object sessionValue = Session["UserID"];
string session = string.Empty;
string password = txtopwd.Text;
if (session != null && int.TryParse(session.ToString(), out userId) && !string.IsNullOrWhitespace(password))
{
var lnguser = from u in lstusers where u.User_ID == userId && u.Pass_word == password.Trim();
}
|
|
|
|
|
|
Sorry, but that makes no sense at all.
Use the best guess
|
|
|
|
|
정성만 wrote: Barcode image binary data must be sent to the printer. Printers do not know how to decode "random" image-formats, and can't handle that kind of data. There's a printer-driver that translates it to the printer-language of that specific brand of printer. Create a <a href="http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx">PrintDocument</a>[<a href="http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx" target="_blank" title="New Window">^</a>] and implement the "PrintPage" event. It has a nice Graphics object that you can draw your image on.
Also, you'd get more useful replies if you added your printing-code to the post. It often shows the intention of the programmer better than a picture can.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
why is my query wrong at FROM ?
i want to connect two tables so i can get some specific data but c# appear error.
try
{
//Set the command string
string Cmd = "SELECT * FROM Robberies_Table JOIN Branches_Table ON Robberies_Table.BranchCode =Branches_Table.BranchCode ;";
//create new new connection to the database
OleDbConnection conn = new OleDbConnection(ConnectionString);
//create new data adapter
OleDbDataAdapter Adapter = new OleDbDataAdapter(Cmd, conn);
//create new command builder
OleDbCommandBuilder CmdBuilder = new OleDbCommandBuilder(Adapter);
dTable = new DataTable();
Adapter.Fill(dTable);
conn.Close();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
//return the search results on a datatable
return dTable;
}
|
|
|
|
|
Your SQL query has a semi-colon in there. Remove it.
|
|
|
|
|
i remove inner semi-colon but the query has error again at from field .
string Cmd = "SELECT * FROM Robberies_Table JOIN Branches_Table ON Robberies_Table.BranchCode =Branches_Table.BranchCode ";
|
|
|
|
|
A couple of things:
- What error does it come up with? Give us a fighting chance here.
- What happens if you run this query directly against your database?
|
|
|
|
|
THE QUERY RUN SUCCESSFULLY AND IS IN THIS FORMAT:
SELECT Robberies_Table.BankName, Robberies_Table.Region, Robberies_Table.BranchCode, Robberies_Table.[Date], Robberies_Table.Ammount,
Robberies_Table.Description, Robberies_Table.Robbery_ID, Robberies_Table.[Year], Branches_Table.BranchName
FROM (Robberies_Table INNER JOIN
Branches_Table ON Robberies_Table.BranchCode = Branches_Table.BranchCode)
IN C# THE QUERY I WRITE IS LIKE THIS :
string Cmd = "SELECT * FROM (Robberies_Table INNER JOIN Branches_Table ON Robberies_Table.BranchCode = Branches_Table.BranchCode);";
AND WHEN I RUN THE PROGRAM NOW ONLY THE RECORD IS UNDER THE BRANCHNAME IT APPEAR IN SCREEN THE DATA OF ROBBERIES TABLE DON'T SHOW ME
modified 2-Apr-13 17:44pm.
|
|
|
|
|
So use that query in your code.
|
|
|
|
|
IN C# THE QUERY I WRITE IS LIKE THIS :
string Cmd = "SELECT * FROM (Robberies_Table INNER JOIN Branches_Table ON Robberies_Table.BranchCode = Branches_Table.BranchCode);";
AND WHEN I RUN THE PROGRAM NOW ONLY THE RECORD IS UNDER THE BRANCHNAME IT APPEAR IN SCREEN THE DATA OF ROBBERIES TABLE DON'T SHOW ME
IF I WRITE THE SAME THAT IS IN MY DATABASE QUERY C# SHOW ME MY CRYSTAL REPORT EMPTY SO I WRITE AS ABOVE AND HAS THE ABOVE ERROR
DIDN'T SHOW ANYTHING:
------------------------
string Cmd = "SELECT Robberies_Table.BankName, Robberies_Table.Region, Robberies_Table.BranchCode, Robberies_Table.[Date], Robberies_Table.Ammount,Robberies_Table.Description, Robberies_Table.Robbery_ID, Robberies_Table.[Year], Branches_Table.BranchName FROM (Robberies_Table INNER JOIN Branches_Table ON Robberies_Table.BranchCode = Branches_Table.BranchCode);";
|
|
|
|
|
I don't know how many different ways I can put this, but try running the same query that you issue in your C# code in the SQL table. You can't run different queries and then expect them to be the same.
|
|
|
|
|
MY DATABASE IS ACCESS NOT SQL AND I OBSERVE THAT HAS MANY DIFFERENCES IN THE WAY YOU WRITE THE QUERY.
BUT ITS OK I WILL TRY MORE AND I WILL FIND THE SOLUTION ANYWAY...
THANK YOU
|
|
|
|
|
Please don't SHOUT. It's not polite.
/ravi
|
|
|
|
|
|
No worries!
/ravi
|
|
|
|
|
Would you plaese remove the * and write the columns that you want to access after joining both the table
like--
select column1,column2 from (table1 JOIN table2 where.....)
|
|
|
|
|
Hello,
i'm moving my actual winform based application to WPF.
My application acquire 1500x1500 8bit depth images at 30 frame per second.
In winform i was used to BitBlt my images to a panel handle and that work fine.
In wpf i tried two ways:
int stride = img_w * ((PixelFormats.Gray8.BitsPerPixel + 7) / 8);
bmpSource = BitmapSource.Create(img_w, img_h, 96, 96, PixelFormats.Gray8, null, my_arrb_8bit, stride);
this.Image1.Source = bmpSource;
but this is too slow...then i try
int max = PixelFormats.Rgb24.BitsPerPixel;
uint count = (uint)(img_w * img_h * PixelFormats.Rgb24.BitsPerPixel / 8);
IntPtr section = CreateFileMapping(new IntPtr(-1), IntPtr.Zero, FileMapProtection.PageReadWrite, 0, count, null);
IntPtr map = MapViewOfFile(section, FileMapAccess.FileMapAllAccess, 0, 0, (UIntPtr)count);
System.Runtime.InteropServices.Marshal.Copy(my_arrb_24bit, 0, map, (int)count);
my_ibs = System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(
section,
(int)img_w,
(int)img_h,
PixelFormats.Rgb24,
(int)(img_w * PixelFormats.Rgb24.BitsPerPixel / 8), 0) as System.Windows.Interop.InteropBitmap;
this.Image1.Source = my_ibs;
this is faster than the first solution, but still i can't manage to reach 30fps....am i doing something wrong? any suggestion?
|
|
|
|
|
Off the top of my head, I'd suspect that the issue that you are hitting is because you are creating new BitmapSource elements each time. Basically, a WPF Bitmap is an immutable object - normally this is a good thing - but in the case where you want to keep changing a source, I'd suggest that you should look at a WriteableBitmap instead. This will give you some ability to mimic the BitBlt functionality.
|
|
|
|