Click here to Skip to main content
15,885,881 members
Home / Discussions / C#
   

C#

 
AnswerRe: Coding Moveable Elements for Games or Whatever Pin
Gerry Schmitz22-Jan-18 12:03
mveGerry Schmitz22-Jan-18 12:03 
QuestionRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen22-Jan-18 13:54
professionalEddy Vluggen22-Jan-18 13:54 
AnswerRe: Coding Moveable Elements for Games or Whatever Pin
Gerry Schmitz22-Jan-18 14:23
mveGerry Schmitz22-Jan-18 14:23 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen22-Jan-18 14:37
professionalEddy Vluggen22-Jan-18 14:37 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Gerry Schmitz22-Jan-18 16:38
mveGerry Schmitz22-Jan-18 16:38 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Eddy Vluggen23-Jan-18 0:20
professionalEddy Vluggen23-Jan-18 0:20 
GeneralRe: Coding Moveable Elements for Games or Whatever Pin
Gerry Schmitz23-Jan-18 7:37
mveGerry Schmitz23-Jan-18 7:37 
QuestionHow to insert the XML file in SQL Server Pin
Jieha Lee19-Jan-18 4:23
Jieha Lee19-Jan-18 4:23 
How to insert this XML file in SQL Server? I have done one but cannot output. The error said "String was not recognized as a valid DateTime"

Here the code that I done:

SqlDataAdapter adpter = new SqlDataAdapter();
DataSet ds = new DataSet();
int appointment_ID = 0;
string nric = null;
string client_Name = null;
DateTime? appointment_Date = null;
DateTime? start_Time = null;
SqlConnection conn = new SqlConnection(@"Data Source=USER1-PC\SQLEXPRESS;Integrated Security=true;Database=ProductDB");
XmlReader xmlFile = XmlReader.Create("G://appointment.xml", new XmlReaderSettings());
ds.ReadXml(xmlFile);
int i = 0;
conn.Open();
for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
appointment_ID = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0]);
appointment_Date = DateTime.Parse(ds.Tables[0].Rows[i].ItemArray[1].ToString());
start_Time = DateTime.Parse(ds.Tables[0].Rows[i].ItemArray[2].ToString());
nric = ds.Tables[0].Rows[i].ItemArray[3].ToString();
client_Name = ds.Tables[0].Rows[i].ItemArray[4].ToString();
SqlCommand command = new SqlCommand("insert into Appointment values(" + appointment_ID + ",'" + appointment_Date + "'," + start_Time + "'," + nric + "'," + client_Name + ")", conn);
adpter.InsertCommand = command;
adpter.InsertCommand.ExecuteNonQuery();
}
conn.Close();
MessageBox.Show("Done .. ");

Here is appointment.xml:

<interface>
<appointment>
<appointment_id> 000000087508
<appointment_date>2018-01-25
<appointment_start_time>13:15:00
<client>
<nric>456987123
<client_name>JAMES


<appointment>
<appointment_id>000000087501
<appointment_date>2018-01-25
<appointment_start_time>14:30:00
<client>
<nric>963258741
<client_name>Bill Tan

<client>
<nric>123456789
<client_name>David Ang


<checksum>2

AnswerRe: How to insert the XML file in SQL Server Pin
OriginalGriff19-Jan-18 4:58
mveOriginalGriff19-Jan-18 4:58 
AnswerRe: How to insert the XML file in SQL Server Pin
jschell20-Jan-18 5:54
jschell20-Jan-18 5:54 
GeneralRe: How to insert the XML file in SQL Server Pin
Laxmidhar tatwa technologies23-Jan-18 5:00
Laxmidhar tatwa technologies23-Jan-18 5:00 
GeneralRe: How to insert the XML file in SQL Server Pin
jschell27-Jan-18 5:09
jschell27-Jan-18 5:09 
QuestionCalling a Method from a Form event Pin
ormonds18-Jan-18 14:08
ormonds18-Jan-18 14:08 
AnswerRe: Calling a Method from a Form event Pin
User 740747018-Jan-18 14:35
User 740747018-Jan-18 14:35 
AnswerRe: Calling a Method from a Form event Pin
OriginalGriff18-Jan-18 20:07
mveOriginalGriff18-Jan-18 20:07 
AnswerRe: Calling a Method from a Form event Pin
ormonds19-Jan-18 17:00
ormonds19-Jan-18 17:00 
GeneralRe: Calling a Method from a Form event Pin
OriginalGriff19-Jan-18 20:34
mveOriginalGriff19-Jan-18 20:34 
QuestionWhy ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884018-Jan-18 8:18
Member 1228884018-Jan-18 8:18 
AnswerRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Richard MacCutchan18-Jan-18 21:10
mveRichard MacCutchan18-Jan-18 21:10 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884019-Jan-18 7:44
Member 1228884019-Jan-18 7:44 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Richard MacCutchan19-Jan-18 8:01
mveRichard MacCutchan19-Jan-18 8:01 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884019-Jan-18 11:30
Member 1228884019-Jan-18 11:30 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Pete O'Hanlon19-Jan-18 22:22
mvePete O'Hanlon19-Jan-18 22:22 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Member 1228884020-Jan-18 6:59
Member 1228884020-Jan-18 6:59 
GeneralRe: Why ControlAccessibleObject' does not contain a definition for: BUY,SELL Pin
Pete O'Hanlon20-Jan-18 22:27
mvePete O'Hanlon20-Jan-18 22:27 

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.