Jump to content

DavidAtWork

Members
  • Posts

    4
  • Joined

  • Last visited

DavidAtWork's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Nevermind,Figured it out.ODBC uses "Positional Parameter Markers" referenced as a ?.So the striing needed to look like this...string strSQL = "INSERT INTO MYTable (Firstname, Lastname, Company) VALUES (?,?,?)";Just make sure the parameters are in the correct order.David
  2. I'm trying to write a sql string that will allow me to enter paramaterized values into a table. Im using Visual Studio 2005, .net 2.0, c#, ASP.NET web form, oracle odbc data source names. ex....String inputFirstName = FirstNameTxtBox.Text;String inputLastName = LastNameTxtBox.Text;String inputCompany = CompanyNameTxtBox.Text;//**********************************************string strSQL = "INSERT INTO MYTable (Firstname, Lastname, Company) VALUES (@EnteredFirstName, @EnteredLastName, @EnteredCompany)";//***** If I use this string I get an ORA-00936 Missing expression error. *** //**********************************************string strSQL = "INSERT INTO MYTable (Firstname, Lastname, Company) VALUES ('@EnteredFirstName', '@EnteredLastName', '@EnteredCompany')";//***** If I use this string it enteres data as read and not the parameter values. *** OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString); OdbcCommand myODBCCommand = new OdbcCommand(strSQL, conn); OdbcParameter param1 = new OdbcParameter(); param1.ParameterName = "@EnteredFirstName"; param1.Value = inputFirstName; OdbcParameter param2 = new OdbcParameter(); param2.ParameterName = "@EnteredLastName"; param2.Value = inputLastName; OdbcParameter param3 = new OdbcParameter(); param3.ParameterName = "@EnteredCompany"; param3.Value = inputCompany; myODBCCommand.Parameters.Add(param1); myODBCCommand.Parameters.Add(param2); myODBCCommand.Parameters.Add(param3);conn.Open();myODBCCommand.ExecuteNonQuery();I have confirmed the parameter values are being populated, they are just not being passed to the DB via the string.Can anyone help?thanks...David
  3. Sounds like a plan. Thanks for the replies.DavidFollow up...Worked just fine...thanks....
  4. I've created a web form using ASP.NET 2.0 with Visual Studio 2005 (C# code behinds) that connects to a Oracle 9i DB. I'm trying to set the "email" column of my form to be unique. I set the unique constraint in Oracle, however , I just found out that Oracle , by default, is case sensitive. I also found out that version 9i cannot be changed to case insensitive. Can someone tell me the best way to handle this or direct me to what I should be studying to be able to figure this out? (C#,ASP.NET, SQL statements, Oracle ??)Basically , I want "david" and "David" to be looked at the same way by Oracle and not allow both versions of the same name to be entered.Any direction would be very appreciated.thanks...David
×
×
  • Create New...