Click here to Skip to main content
15,891,409 members
Home / Discussions / Database
   

Database

 
GeneralRe: DB Connection Failure using C# Pin
Cadence2.011-Jul-06 11:47
Cadence2.011-Jul-06 11:47 
QuestionStored Procedures Pin
HRiazi11-Jul-06 6:50
HRiazi11-Jul-06 6:50 
AnswerThe best third party tool Pin
Ennis Ray Lynch, Jr.12-Jul-06 7:15
Ennis Ray Lynch, Jr.12-Jul-06 7:15 
QuestionSQL Server files very large Pin
dptalt11-Jul-06 5:17
dptalt11-Jul-06 5:17 
AnswerRe: SQL Server files very large Pin
Eric Dahlvang11-Jul-06 7:48
Eric Dahlvang11-Jul-06 7:48 
GeneralRe: SQL Server files very large Pin
dptalt13-Jul-06 3:09
dptalt13-Jul-06 3:09 
GeneralRe: SQL Server files very large Pin
Eric Dahlvang13-Jul-06 3:52
Eric Dahlvang13-Jul-06 3:52 
QuestionSQL String to insert values into a table that are C# variables. Pin
DavidSAtWork11-Jul-06 4:51
DavidSAtWork11-Jul-06 4:51 
Hello,
Im trying to create a SQL string that will insert values (Values that were gathered from a ASP.NET web form) into a table. The values are C# variables. I can insert manually typed values 'string' but when I try to make it a variable , I get an error. ORA-00984: column not allowed here. I either need the correct syntax for the sql string (values) or need to know the correct method for inserting C# variables into an oracle database.
Using MSVisual Studio 2005, ASP.NET webform, C#, Oracle 9i DB.

Sample of the code Im using...
protected void SubmitBtn_Click(object sender, EventArgs e)
{

String TodayStamp = DateTime.Today.ToString();
String EnteredFirstName = FirstNameTxtBox.Text;
String EnteredLastName = LastNameTxtBox.Text;
String EnteredCompany = CompanyNameTxtBox.Text;
String EnteredEmail = EmailAddTxtBox.Text;
String EnteredCity = CityTxtBox.Text;
String EnteredState = StateDropDownList.SelectedValue;
String EnteredCountry = CountryDropDownList.SelectedValue;

string strSQL = "INSERT INTO table(Firstname, Lastname, Company, Email, City, State, ActivityDate, Country) VALUES (EnteredFirstName, EnteredLastName, EnteredCompany, EnteredEmail, EnteredCity, EnteredState, TodayStamp, EnteredCountry )" ;

OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);

OdbcCommand myODBCCommand = new OdbcCommand( strSQL, conn);

try
{
conn.Open();
myODBCCommand.ExecuteNonQuery(); **Errors Here**
}

catch
{
}
finally
{
conn.Close();
}
}

Can anyone help please??
thanks...

David
AnswerRe: SQL String to insert values into a table that are C# variables. Pin
albCode11-Jul-06 5:00
albCode11-Jul-06 5:00 
GeneralRe: SQL String to insert values into a table that are C# variables. Pin
Colin Angus Mackay11-Jul-06 5:05
Colin Angus Mackay11-Jul-06 5:05 
GeneralRe: SQL String to insert values into a table that are C# variables. Pin
albCode11-Jul-06 5:12
albCode11-Jul-06 5:12 
AnswerRe: SQL String to insert values into a table that are C# variables. Pin
Colin Angus Mackay11-Jul-06 5:08
Colin Angus Mackay11-Jul-06 5:08 
GeneralRe: SQL String to insert values into a table that are C# variables. Pin
User 171649211-Jul-06 5:38
professionalUser 171649211-Jul-06 5:38 
AnswerRe: SQL String to insert values into a table that are C# variables. Pin
DavidSAtWork11-Jul-06 5:52
DavidSAtWork11-Jul-06 5:52 
AnswerRe: SQL String to insert values into a table that are C# variables. Pin
kumarprabhakar7412-Jul-06 0:56
kumarprabhakar7412-Jul-06 0:56 
QuestionSQL 2005 Backup Problem Pin
DineshSharma11-Jul-06 1:43
DineshSharma11-Jul-06 1:43 
AnswerRe: SQL 2005 Backup Problem Pin
albCode11-Jul-06 5:11
albCode11-Jul-06 5:11 
Questionauto upload/export of a downloaded CSV file to SQLSERVER on the server Pin
amitcoder8310-Jul-06 19:51
amitcoder8310-Jul-06 19:51 
AnswerRe: auto upload/export of a downloaded CSV file to SQLSERVER on the server Pin
Paul Conrad10-Jul-06 21:41
professionalPaul Conrad10-Jul-06 21:41 
QuestionWhere do i start? [modified] Pin
[Marc]10-Jul-06 18:41
[Marc]10-Jul-06 18:41 
AnswerRe: Where do i start? Pin
Colin Angus Mackay10-Jul-06 20:17
Colin Angus Mackay10-Jul-06 20:17 
AnswerRe: Where do i start? Pin
Eric Dahlvang11-Jul-06 6:04
Eric Dahlvang11-Jul-06 6:04 
QuestionFirst record in list creates 'System.Data.DataRowView' Pin
Glen Harvy10-Jul-06 15:31
Glen Harvy10-Jul-06 15:31 
QuestionConnecting to SQL Server Express 2005 using C# Pin
Cadence2.010-Jul-06 14:20
Cadence2.010-Jul-06 14:20 
AnswerRe: Connecting to SQL Server Express 2005 using C# Pin
Paul Conrad10-Jul-06 14:39
professionalPaul Conrad10-Jul-06 14:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.