|
HttpContext currentContext = HttpContext.Current;
string ip = currentContext.Request.UserHostAddress;
The MAC Address is unlikely to be the MAC of the machine browsing the web site. The MAC address of the IP packets changes as the packets pass through routers.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return!
- David Walliams (Little Britain)
|
|
|
|
|
If you get it (and I'm not saying you can), then you would have to be very careful about what you do with it - you could easily break a lot of privacy laws
|
|
|
|
|
In a web application, there is no way to get the MAC address of the client. It wouldn't do you any good either since it only means something to the local subnet that the client machine is attached to.
The MAC address that you might get is going to the from the last network interface to touch the packet before it got to your web server. This is usually the near-side of the last router or firewall that touched the packet before it got to your server. It will also be the same for every packet you get unless there is an alternate route for IP traffic to get to your server.
|
|
|
|
|
There shouldn't be a need for it, but you could ask the visitor for it.
Don't attempt any sort of security or identity based on such addresses.
|
|
|
|
|
I need some help in my project.
I am trying to insert a row in my database table using a SQL query from my dataset.
If I execute the query from query builder, it is able to insert a new row to my database table.
But, as I am trying to use the same query from my code, and try to view the rows from my code (using a getdata() query), the newly inserted row is shown, but if I close the my project, I run it after some time, the recently inserted row is gone ..... I checked the database, but the new row is not there .....
What can be wrong ? Please provide me some guidance ...
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
Can you the insertion code you are using?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
INSERT INTO PatientsDetails
(FirstName, LastName, DateOfBirth, BloodGroupId, Gender)
VALUES (@FirstName,@LastName,@DateOfBirth,@BloodGroupId,@Gender);
SELECT ReferenceId, FirstName, LastName, DateOfBirth, BloodGroupId, Gender FROM PatientsDetails WHERE (ReferenceId = SCOPE_IDENTITY())
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
I modified the above query as
INSERT INTO PatientsDetails
(FirstName, LastName, DateOfBirth, BloodGroupId, Gender)
VALUES (@FirstName,@LastName,@DateOfBirth,@BloodGroupId,@Gender);
Still its happening the same ...
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
This may sound stupid, but are you querying the same DB programatically, and via the SQl query? Have you checked your connection string?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
I meant the C# code. If this query is working through management studio, it must be correct. There has to something wrong in your code.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (txtFirstName.Text == "")
MessageBox.Show("Patient's First Name can't be blank", "Incomplete data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else if (txtDOB.Text == "")
MessageBox.Show("Patient's Date of Birth can't be blank", "Incomplete data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (txtLastName.Text == "")
txtLastName.Text = " ";
bool gender = true;
if (!rbMale.Checked)
gender = false;
MRMDbDataSetTableAdapters.PatientsDetailsTableAdapter pdta = new MediRecordManager.MRMDbDataSetTableAdapters.PatientsDetailsTableAdapter();
if (pdta.AddNewPatient(txtFirstName.Text, txtLastName.Text, calDOB.SelectionStart, (byte)cbBloodGroup.SelectedValue, gender) > 0)
{
MessageBox.Show("Data inserted to database !");
btnCancel.Text = "Close";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
You are just adding the row to a table in your in-memory dataset. At least that's all the code you've posted does.
To save it to the database, call Update() on the data adapter created for your typed data set.
|
|
|
|
|
Are you using an access database?
If not just ignore the rest of this posting.
Some time ago, someone had the same problem with an access database.
His problem was, that he added the empty .mdb file to the project, and every time
he build his solution the empty database has overwritten the one with data in it.
Greetings
Covean
|
|
|
|
|
I am using MS SQL 2008 server database
Apurv
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)
“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)
|
|
|
|
|
Do you use transactions (maybe indirect?)?
Thats the last idea I have for solving your problem.
Greetings
Covean
|
|
|
|
|
You have a SQL command that returns a BLOB. You are retrieving the data via a DataReader, but you are having problems using the default behavior.
Referring to the scenario above, which one of the following
CommandBehavior options, specified as an argument to the ExecuteReader method, allows you to use the GetBytes() method to retrieve the BLOB from a stream?
Choice 1
CommandBehavior.SequentialAccess
Choice 2
CommandBehavior.SingleResult
Choice 3
CommandBehavior.SingleRow
Choice 4
CommandBehavior.LargeData
Choice 5
CommandBehavior.BinaryAccess
|
|
|
|
|
Seriously, it sounds like you're posting questions from an exam. Maybe you should do your own homework!
|
|
|
|
|
Having difficulty with your homework?
Try learning to use Google. Typing in the three relevent words from your question, the top hit was the answer.
Try and do something for yourself, will you?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
OriginalGriff wrote: Typing in the three relevent words from your question, the top hit was the answer.
You actually tried this! Seems you have a lot of time to kill.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
30 seconds, tops. That's only a quick type while I glug some coffee. I like to check my answers - nothing worse than wrong advice from somewhere full of "experts"!
I figured it would be near the top, but the top hit, giving the answer in exactly the words the OP used, is pushing someones "research" skill a bit, I feel...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
OriginalGriff wrote: I like to check my answers - nothing worse than wrong advice from somewhere full of "experts"!
I like to be on safer side. Hence my sig.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
There are classes that are common to both the Microsoft Oracle provider and the Oracle ODP.NET provider. While certain methods or properties will vary between the implementations, the high-level concept is generally the same.
Based on the above scenario, which one of the following CLASSes is only available in one of the providers but not both?
Choice 1
OracleInfoMessageEventArgs
Choice 2
OracleRowUpdateEventArgs
Choice 3
OracleParameter
Choice 4
OraclePermission
Choice 5
OracleBFile
|
|
|
|
|
Come on, do your own homework you lazy individual.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
|
If you add a reference to System.Data.OracleClient & the oracle odp client you will be able to find out.
Just had a quick look and the answer is OraclePermission is not in ODP.NET. If your thinking of which one to use I would vote for ODP.NET as the latest version allows you to map oracle objects to your own objects
The FoZ
|
|
|
|