Here is the sql statment from System.Console.Out.WriteLine(sqlString); sql string = "INSERT INTO Cafe (CustomerNumber, FirstName, LastName, Address, City, Province, PostalCode, PhoneNumber, UserName, Password, TimePurchased) VALUES (2,'Bill','Ray','anystreet','Hometomwn','ont',N6BYK6','6727894','Rbill','123456',0)"
Rinventive
Posts
-
C# Sql INSERT statment -
C# Sql INSERT statmentHere is my current statment string sqlString = "INSERT INTO Cafe (CustomerNumber, FirstName, LastName, Address, City, Province, PostalCode, PhoneNumber, UserName, Password, TimePurchased ) VALUES (" + newNum.ToString() + ",'" + FirstNameTxt.Text + "','" + LastNameTxt.Text + "','" + AddressTxt.Text + "','" + CityTxt.Text + "','" + ProvinceTxt.Text + "','" + PostalCodeTxt.Text.ToUpper() + "','" + PhoneNumTxt.Text + "','" + UserNameTxt.Text + "','" + PasswordTxt.Text + "'," + TimePurchaseTxt.Text + ")"; and my current db CustomerNumber (autonumber) FirstName (Text) //Bill LastName (Text) //Ray Address (Text) //anystreet City (Text) //Hometown Province (Text) //Ont PostalCode (Text) //N5BY4G PhoneNumber (Number) //123456 UserName (Text) //Rbill Password (Text) //whatever TimePurchased (Number) //1 I how\pe this helps
-
C# Sql INSERT statmentHere is the INSERT statment I started with, this is from a previous project and it works fine. string sqlString = "INSERT INTO Members (MemberNum, FirstName, LastName, Address, City, Province, PostalCode, Status, Balance ) VALUES (" + newNum.ToString() + ",'" + FirstName.Text + "','" + LastName.Text + "','" + Address.Text + "','" + City.Text + "','" + comboBox1.Text + "','" + PostalCode.Text.ToUpper() + "','" + GetMemberStatus() + "'," + BalanceOwing.Text + ")"; and the db information MemberNum (autonumber) LastName (text) FirstName (text) Address (text) City (text) Province (text) PostalCode (text) Status (text) Balance (number) Sorry to be so much trouble and thanks for your time
-
C# Sql INSERT statmentI used the System.Console.Out.WriteLine(sqlString); so I could read what valuse are in the statment durning debug...I can't seem to see anything wrong. Just inexperienced and need practice.
-
C# Sql INSERT statmentI read the article, Thank you...after I get it working I will try to make it safer
-
C# Sql INSERT statmentI'm not sure what you mean "dump it to the console" and none of the text input has anything other then letters and numbers. I'm new to this...Thanks
-
C# Sql INSERT statmentI still have a problem....this is what I did to remove the CustomerNum string sqlString = "INSERT INTO Cafe ( FirstName, LastName, Address, City, Province, PostalCode, PhoneNumber, UserName, Password, TimePurchased ) VALUES (" + FirstNameTxt.Text + ",'" + LastNameTxt.Text + "','" + AddressTxt.Text + "','" + CityTxt.Text + "','" + ProvinceTxt.Text + "','" + PostalCodeTxt.Text.ToUpper() + "','" + PhoneNumTxt.Text + "','" + UserNameTxt.Text + "','" + PasswordTxt.Text + "'," + TimePurchaseTxt.Text + ")"; Error -- Syntax error in INSERT INTO statment Thanks for your help!!
-
C# Sql INSERT statmentThe autonumber is controled by Access. each feild does have a value when I debug.
-
C# Sql INSERT statmentI am trying to insert data into a Access db. I am able to connect to the db fine. I get an error in the catch telling me I have a problem with my sql statment. This is my sql statment. (I have checked the spelling of all variables and field, table names etc...) All information is comming from textboxes --except newNum -- uses a method to find the next avalible number (worked like this on a different db) string sqlString = "INSERT INTO Cafe (CustomerNumber, FirstName, LastName, Address, City, Province, PostalCode, PhoneNumber, UserName, Password, TimePurchased ) VALUES (" + newNum.ToString() + ",'" + FirstNameTxt.Text + "','" + LastNameTxt.Text + "','" + AddressTxt.Text + "','" + CityTxt.Text + "','" + ProvinceTxt.Text + "','" + PostalCodeTxt.Text.ToUpper() + "','" + PhoneNumTxt.Text + "','" + UserNameTxt.Text + "','" + PasswordTxt.Text + "'," + TimePurchaseTxt.Text.ToString() + ")"; the Access db is called Assignment3 the table is called Cafe CustomerNumber (autoNumber) PK FirstName (Text) LastName (Text) Address (Text) City (Text) Province (Text) PostalCode (Text) PhoneNumber (Number) UserName (Text) Password (Text) TimePurchased (Number) I am new to sql and would really like some help Thanks
-
Short cut icons on a windows formI am making a windows form and I would like to place buttons or icons that will start other applications from the form. I am programming this is c#. I would like to know what I need to do to get the button to start other programs .exe Thanks for any help
-
C# DirectX Loading multiple .x filesI am new to DirectX programming and I am looking for a little help setting up methods to load multiple .x files and textures. If anyone has any examples that I could look at it would be helpful. If you have any questions or if I need to clarify what I what I am looking for please write. Thanks for any help any help out there?