Click here to Skip to main content
15,903,203 members
Home / Discussions / Database
   

Database

 
QuestionSQl statement doesn't work why? Pin
jlawren723-Oct-04 14:12
jlawren723-Oct-04 14:12 
AnswerRe: SQl statement doesn't work why? Pin
afronaut24-Oct-04 6:29
afronaut24-Oct-04 6:29 
QuestionInsert into Syntax error? Pin
mikhaelb23-Oct-04 12:54
mikhaelb23-Oct-04 12:54 
AnswerRe: Insert into Syntax error? Pin
Colin Angus Mackay23-Oct-04 14:02
Colin Angus Mackay23-Oct-04 14:02 
GeneralRe: Insert into Syntax error? Pin
jlawren723-Oct-04 14:08
jlawren723-Oct-04 14:08 
GeneralRe: Insert into Syntax error? Pin
Colin Angus Mackay23-Oct-04 14:29
Colin Angus Mackay23-Oct-04 14:29 
Generalsql to export access table to html file Pin
jlawren723-Oct-04 10:41
jlawren723-Oct-04 10:41 
GeneralRe: sql to export access table to html file Pin
afronaut24-Oct-04 6:46
afronaut24-Oct-04 6:46 
GeneralMS OLAP Visual C++ (.NET) samples Pin
Ilgar22-Oct-04 23:43
Ilgar22-Oct-04 23:43 
GeneralProblem with SQL Server RaiseError with C# Pin
Graham W22-Oct-04 0:58
Graham W22-Oct-04 0:58 
GeneralSQL statement against MS access Pin
21-Oct-04 14:20
suss21-Oct-04 14:20 
GeneralRe: SQL statement against MS access Pin
afronaut21-Oct-04 14:43
afronaut21-Oct-04 14:43 
GeneralRe: SQL statement against MS access Pin
jlawren721-Oct-04 15:53
jlawren721-Oct-04 15:53 
GeneralRe: SQL statement against MS access Pin
afronaut24-Oct-04 6:11
afronaut24-Oct-04 6:11 
GeneralRecursive Triggers Pin
afronaut21-Oct-04 13:33
afronaut21-Oct-04 13:33 
GeneralRe: Recursive Triggers Pin
WoutL22-Oct-04 1:25
WoutL22-Oct-04 1:25 
GeneralSQL query - deleting main row, its related rows, and their related rows Pin
Luis Alonso Ramos21-Oct-04 8:58
Luis Alonso Ramos21-Oct-04 8:58 
GeneralRe: SQL query - deleting main row, its related rows, and their related rows Pin
TimWallace21-Oct-04 9:32
TimWallace21-Oct-04 9:32 
GeneralRe: SQL query - deleting main row, its related rows, and their related rows Pin
Luis Alonso Ramos21-Oct-04 9:53
Luis Alonso Ramos21-Oct-04 9:53 
GeneralADO question Pin
Tom Wright21-Oct-04 5:32
Tom Wright21-Oct-04 5:32 
GeneralDatalist with pages Pin
David Fawn21-Oct-04 5:03
David Fawn21-Oct-04 5:03 
QuestionWhy won't this update to my Database? Pin
fortyonejb21-Oct-04 4:52
fortyonejb21-Oct-04 4:52 
Okay so i'm having some trouble with adding to my database through the dataset. i can read from it and it prints just fine, i run the code okay with no errors, but it simply doesn't add the record, i've left it simple here just so i can get it right before i start adding the extra functionality. okay so the table name is UserID, and i want to add into the table, what am i doing wrong?

private void btnAddRecord_Click(object sender, System.EventArgs e)<br />
		{<br />
			string ConnectString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\salesleadmgmt.mdb";<br />
			OleDbConnection AddConnection = new OleDbConnection(ConnectString);<br />
			OleDbDataAdapter addAdapter = new OleDbDataAdapter("Select * from UserID", AddConnection);<br />
			DataSet addSet = new DataSet();<br />
			DataRow addRow;<br />
			<br />
			OleDbCommandBuilder addCommandBuilder = new OleDbCommandBuilder(addAdapter);<br />
<br />
			addAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;<br />
			addAdapter.Fill(addSet, "UserID");<br />
			<br />
			<br />
			addRow = addSet.Tables["UserID"].NewRow();<br />
			addRow["UsrName"] = "Bob";<br />
			addRow["passwr"] = "Bobpwd";<br />
			addRow["UsrID"] = "6";<br />
			addSet.Tables["UserID"].Rows.Add(addRow);<br />
			addSet.AcceptChanges();<br />
			addAdapter.Update(addSet, "UserID");<br />
			addAdapter.Fill(addSet, "UserID");<br />
			UsrGrid.DataSource = addSet;<br />
			UsrGrid.DataBind();<br />
			<br />
		<br />
		}

Now, its working so far as on the UsrGrid i see the "bob" entry, but afterwards its not in the database, why isnt the DataSet writing to my database???

this runs in the .CS file, i don't get any of the write lines or anything, it does run on a button click, i have another button click that works fine, i'll show that one, whats wrong with this first one?

working display click
private void Button1_Click(object sender, System.EventArgs e)<br />
		{<br />
			string ConnectString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\salesleadmgmt.mdb";<br />
			OleDbConnection CustConnection = new OleDbConnection(ConnectString);<br />
			CustConnection.Open();<br />
<br />
			DataSet CustSet = new DataSet();<br />
			OleDbDataAdapter CustAdapt = new OleDbDataAdapter("SELECT * FROM CustInfo", CustConnection);<br />
			CustAdapt.Fill(CustSet);<br />
			CustConnection.Close();<br />
			CustGrid.DataSource = CustSet;<br />
			CustGrid.DataBind();<br />
		}

Generalupdating a database in C# Pin
steve_rm21-Oct-04 4:10
steve_rm21-Oct-04 4:10 
GeneralVB, ADO, XP - Which one is falling over?! Pin
Pete Belcher20-Oct-04 23:04
Pete Belcher20-Oct-04 23:04 
GeneralRe: VB, ADO, XP - Which one is falling over?! Pin
Michael Potter21-Oct-04 5:05
Michael Potter21-Oct-04 5:05 

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.