
|
You don't need to check the value here, since your passing the value to a function, just make sure the value is good before passing it the fucntion, so remove the first line and do it earlier, when your gather data
if (Request.ServerVariables["REMOTE_ADDR"] != null) sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = Request.ServerVariables["REMOTE_ADDR"];
else sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
I;m not sure what the problem is. I see lot's of tiny errors like the @ in front of the parameter name. @param_id_number
INSERT INTO event_log (event_log_category, event_log_user, event_log_ip_address, event_log_machine_name, event_log_os_version, event_log_text) VALUES ('Audit', @param_id_number, @param_ip_address, @param_machine_name, @param_os_version, 'User logged on successfully');
Those examples I gave you, you really need to look at the details of them.
On the param, you have to declare the variable, then make a new one. If you made the table column a width of let's say 80, use the 80.
I did some digging, and I stopped using the Server Request because it was not reliable, and changed to the UserHostAddress, use the context whenever you use request or response as a good habit.
Dim ipAddress as String = Nothing
ipAddress = HttpContext.Current.Request.UserHostAddress
Dim param_id_number As SqlParameter
param_id_number = New SqlParamter("@ip_Address, SQLDbType.VarChar, 80)
param_id_number.Value = <- Assign a pointer here like ipAddress
sql_command.Parameters.Add(param_ip_address)
|
|
|
|