jump to navigation

MySQL and ASP.NET Revisited January 13 2006

When dealing with parameterized SQL in ASP.NET, usually most (if not all) books will tell you that the magic parameters are preceeded with an “@” symbol (e.g. @myParam) as in :

INSERT INTO myTable VALUES (NULL, @myParam)

However when dealing with MySQL ye may not use the “@” symbol, ye may use the “question mark” such as :

INSERT INTO myTable VALUES (NULL, ?myParam)

===

When actually assigning the parameter values (after the SQL stmt) you would proceed to use the normal “@” symbol

e.g.

param = New MySqlParameter(”@myParam”, MySqlDbType.String, Me.Text.Length, “myColName”)
param.Value = “This is some value”

Enjoy!

Authentication Using the Request.ServerVariables Object January 09 2006

A quick way to grab the login of a user on a local network through ASP.NET is to use the Request.ServerVariables object.

Specifically : Request.ServerVariables(”LOGON_USER”)

This will provide a string such as “DOMAIN\USER_ID”

One thing to note is that you need to have anonymous access turned off before it can see the NT Authentication