|
I am writing a large data to MS access via reader.
I needed to change query from storedprocedure to text since I needed to create the database I was going to write. And I do not know to create a query in MS access via C#.
Now I recognized that the writing process slowed down significantly. Is it true that Stored Procedure works faster compared to commandtype.text.
Moreover do you know how to create query in MS Access via C#.
Thanks in advace
|
|
|
|
|
Not sure about Access but there are lots of discussions regarding SQL Server[^] that have been going on for what seems like centuries.
IIRC there is not longer a dramatic difference between then (in SQL). In Access you are screwed before you start so it probably does not matter.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you for the motivation :P.
|
|
|
|
|
Sorry but I class working with Access only marginally better than coding in VB6, now if you were doing both I would have some real sympathy !
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
All I want the procedure to do is execute the sql statement that I pass it. I do not want or need any result to be passed back as the stored procedures will update or or insert to the tables.
private void SQLExecution(string WhatismyConnectionString, string MySQLStatement)
{
//This is the command I am passing in the SQL Statement...
//It is a stored procedure that simply does a deletion to the table.
//WhatismyConnectionString = "sp_vc_NoLongerExist + @MachineName + @UserName + @AppName"
SqlConnection conn = new SqlConnection(WhatismyConnectionString);
SqlCommand command = conn.CreateCommand();
command.CommandText = MySQLStatement;
command.CommandType = CommandType.Text;
// execute the command that returns a SqlDataReader
object returnvalue = command.ExecuteScalar();
MessageBox.Show("YEA?");
}
|
|
|
|
|
Hi JollyMansArt,
Please open the connection before using it.
Also,close the connection after you finish with it.
himanshu
|
|
|
|
|
Open your connection
Commandtype should be command.StoredProcedure
Create parameter object and then define all your parameter and then add your parameter in command object as
command.Parametyer.Add(put your parameter object here)
And execute as ExecuteNonQuery command.ExecuteNonQuery
Thanks,
Atin
|
|
|
|
|
Open the connection
Niladri Biswas
|
|
|
|
|
Dear All,
I have following xml which i want to convert it into DataTable, but it doesent reports any record
the xml file contents
<DownloadedForms>
<row>
<CommunityCode>28-2801-0001</CommunityCode>
<FormName>Form6</FormName>
<FormPage>1</FormPage>
<FormPath>c:\PDF Files\BAMYAN\Bamyan\28-2801-0001\Form6\28-2801-0001-F6.pdf</FormPath>
<isVerified>2</isVerified>
<RejectionReason>The Form is Scanned in low Quality</RejectionReason>
<Id>6</Id>
<ProvinceID>28</ProvinceID>
</row>
</DownloadedForms>
and the code to read the xml file is
XmlTextReader read=new XmlTextReader("xmltopic.xml");
while (read.Read()) {
}
DataTable dt=new DataTable();
dt.ReadXml(read);
MessageBox.Show(dt.Rows.Count.ToString());
how can i convert that xml into dataTable?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Try
DataSet ds = new DataSet();
ds.ReadXml("FileName");
himanshu
|
|
|
|
|
Yes its working!!
go ahead with Himanshu code

|
|
|
|
|
|
do some googling
you will get it
|
|
|
|
|
Please, don't delete your messages. It's not helpful to other people who are searching for an answer to a related question
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
I am really sorry, In fact i was trying to response for "himunshu1256", but i dont know y the respone was automoated to "savetiger".
I had responed to "himunshu1256" two times, but in both the message was redirected to "savetigers"
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Creating DataTable from XML DataTable
DataTable mytab = new DataTable();
mytab.ReadXml("c:\\myfile.xml");
To Read your XML file U have read it to a Dataset.
like
Dataset myds = new Dataset ();
myds.ReadXml("c:\\tt.xml");
Get your table from
myds.Tables[0].Rows.Count
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I wrote a program to download .jar file to mobile ,but its is saving as .aspx file to mobile and it is reporting an error like this file is not supported by the device.But there is no problem with windows mobiles..
Please Help me to find out the solution for this.
Code Snippet I used to download as follows
protected void Command1_Click(object sender, EventArgs e)
{
string EXEPath = System.Configuration.ConfigurationManager.AppSettings["downloadEXEPath"].ToString();
string exefilename = System.Configuration.ConfigurationManager.AppSettings["EXEFileName"].ToString();
HttpRequest httpreq = Context.Request;
HttpResponse httpres = Context.Response;
FileInfo fil = new FileInfo(Server.MapPath("~\\" + EXEPath));
if (fil.Exists == true)
{
httpres.Clear();
httpres.ContentType = "application/java-archive jar";
httpres.AddHeader("Content-Length", fil.Length.ToString());
httpres.AddHeader("content-disposition", "attachment; filename=" + exefilename);
httpres.BinaryWrite(File.ReadAllBytes(Server.MapPath("~\\" + EXEPath)));
httpres.Flush();
httpres.End();
}
}
|
|
|
|
|
hi again , is there any way to dock a windows forum to the bottom right hand corner ?
Above the taskbar and to the right hand side of the screen ?
Thanks
modified on Wednesday, June 24, 2009 9:51 PM
|
|
|
|
|
Do you mean a form ?
There is nothing built in to do this, but you can write code to find out the size of the main screen, position it where you want, and handle the event when the form is moved, and move it back.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
this may give you some ideas[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a WinForm with a DropDownList and DataGridView. I need to display the States based on the Country selected.
This is my Code:
private void cbCountry_SelectedIndexChanged(object sender, EventArgs e)
{
if (loading == false)
{
CountryId = (int.Parse(cbCountry.SelectedValue.ToString()));
this.dsWBGT = dataComm.GetStateByCountryId(CountryId);
dgvState.DataSource = this.dsWBGT;
}
}
When I step through the app everything works and the dataset gets the correct info but the DataGridView only display (Collection)
Can someone tell me what am I doing wrong?
I am populating the combobox with the following code:
private void PopulateCountries()
{
DataSet dsCountries = dataComm.GetCountries();
cbCountry.DataSource = dsCountries.Tables["Country"].DefaultView;
cbCountry.DisplayMember = "Country";
cbCountry.ValueMember = "Id";
}
Illegal Operation
|
|
|
|
|
Nevermind I found the problem...
Illegal Operation
|
|
|
|
|
|
Instead of referencing the datagridview (dgvState.DataSource = this.DataSet) I used the bindingsource (bindingSource.DataSource = this.DataSet).
Illegal Operation
|
|
|
|
|
In JavaScript you can run document.getElementsByTagName ("img") to get all of the image tags. Can you do something similar in C#?
Also you can do this is JavaScript:
var image = document.createElement ("img");
image.getAttribute ("src");
Again can you do something similar in C#? And if so, how?
This is how I'm getting the webpage: http://www.tech-recipes.com/rx/1954/get_web_page_contents_in_code_with_csharp/[^]
Thanks.
|
|
|
|