|
This is simple, i wont to insert into a database some values, here is the code:
private void insertToDB(SQLConnection conn)<br />
{<br />
String sql = "";<br />
SqlCommand command;<br />
<br />
try<br />
{<br />
conn.Open(); <br />
<br />
foreach (customerGroup group in customerGroups)<br />
{<br />
command = null;<br />
sql = "INSERT " + group.getID() + ", '" + group.getGroupName() +"', " + group.getGroupParentID() + ", " + group.getLevel() + " INTO [custGroups]";<br />
command = new SqlCommand(sql, conn);<br />
command.BeginExecuteNonQuery(); <br />
} <br />
<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}<br />
finally<br />
{<br />
conn.Close();<br />
}<br />
<br />
}
My connectionstring is:
Server=XXX\YYY;Database=ValkyriaDB;User ID=XXX;Password=YYY;Trusted_Connection=False;Asynchronous Processing=True;
(sorry about the smile but i did not know how to disable them)
My first question is that one running this it throws exception that i must enable Asynchronous Processing in my connection string, why is this?
Ok, so i enabled it. What happens, it throws a new exception connection does not support MultipleActiveResultset series.
So could somebody help me with this, because i simply dont understand. Im a java programmer and the above code is identical to my java code except for that i use prepered statements i the loop. If there is a better and easier way to do this please also tell me.
Johan
-- modified at 7:57 Monday 26th June, 2006
|
|
|
|
|
|
Hello all,
i am using asp.net 1.1. I want to disable the Browser back functionality means when clicking on back button it should not be goes back.
how to do this.
plz help me
regards
GV Ramana
|
|
|
|
|
Are you talking the desktop browser or a browser in your own application?
If you mean in you own application, the way to prevent GoBack() from everworking would be to clear your browser object's history after each navigate completes. Unfortunately I haven't found a way to do that and I can't find any codeproject articles or when searching MSDN, searching with Google and searching with MSN search that explain how to do it.
My quick and dirty suggestion would be to not implement/expose that functionality by leaving off the "back" button in your application. Additionally, since you cannot go back, it would make no sense to implement a "forward" button either. Unfortunately that leaves open the possibility that the user will use the backspace button while the focus is on the browser window and not in an editable field which would most likely cause a GoBack() to occur.
Sorry, best I can do for you.
Mike Poz
|
|
|
|
|
Hello all,
for asp.net 1.1 project, i have oracle 9i client. Using 9i client i am able to access the clinet. but with asp.net application it is giving following error
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
i am given permissions to ora92 folder. still it is givng same problem
any solution.
regards
GV Ramana
|
|
|
|
|
|
i want to write and read file with attribute and properties and value.plz help me.
-- modified at 7:30 Monday 26th June, 2006
|
|
|
|
|
Check these classes in your MSDN:
XmlDocument
XmlReader
XmlWriter
|
|
|
|
|
thanks. i am trying. can u give me a complete example.
|
|
|
|
|
|
hi all,
how can i get my computer's ip or mac address with c# ?
is there a tutorial to learn much about getting tcp/ip settings ?
thanks in advance, bye.
|
|
|
|
|
http://www.codeproject.com/cs/internet/host_info_within_network.asp
|
|
|
|
|
This possible in .NET 2.0.
|
|
|
|
|
Mehmet Fatih Akbulut wrote: how can i get my computer's ip or mac address with c# ?
Mac Address[^]
IP Address[^]
You can try googling to get more details.
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
Hi!
I don't even know if this is possible or not...
I have an (3rd Party) application, that writes text into a logfile. I want to intercept this filestream an handle it in my own application. Is it possible (and how is it possible?) to redirect the stream into my application (or to get a copy of it)? I suppose that I have to use some win32-Api functions to achieve this.
Any help is appreceated
Thanks
Dirk
|
|
|
|
|
|
thanks a ton in advance
how should we add for value members and display members if binding is through the datareader and not dataset
currently i add using a loop due to which i cannot set the value memebers and display members had i done that using datasets
ComboBox1.Items.Clear()
If (dr !=null)
{
while (dr.Read())
{
ComboBox1.Items.Add(dr"Name"]);
}
}
The secret of gettting ahead is getting started
|
|
|
|
|
Why don't you use the datareader to populate the dataset?
|
|
|
|
|
thanks paul,
what you suggested can be done , But Just wanted to know if using datareader directly against combobox and setting value members and display members is possible ..
and again
if i am using datareader to fill the dataset against dataadapter , what difference in the performance will it make (please consider this query to be on lower priority;))
please tell if some work around is possible ..
|
|
|
|
|
Hi All,
My app is MTA, because it needs to be for directshow. I'm now wanting to use OpenFileDialog, but it seems to not work: calling ShowDialog results in a ThreadStateException with additional information
"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process"
Anyone got any ideas for an alternative or a workaround? My main thread needs to stay MTA, or directshow stuff i'm doing will not work.
Any help greatly appreciated!
Jon
using System.Beer;
|
|
|
|
|
Hello
Why don't you make another STA thread, and show the openfile dialog within it?
|
|
|
|
|
Problem with that is that if i show the dialog from another thread then i can do one of two things with my UI thread:- either Join on the worker thread (which locks the UI to the extent that it won't even redraw), or i can use a callback/message/event and invoke the dialog asyncronously - but then the main app's UI will be active because the dialog won't be modal.
using System.Beer;
|
|
|
|
|
Well, I anticipated this, but I believe the solution is simple.
1- Make a bool value that is always false
2- At each UI event (click, highlight, etc...) you check that value, if it's false continue
3- When you show the openfileDialog -or just any other dialog- you set this value to true and create and object reference to that dialog (of type Control maybe)
4- When the dialog returns, you set it to false again -so that the UI will work again-, then process the data returned by that dialog
In the Focus event -when the user set the focus to your main Application- check if the object reference is null, if not call its Control.Focus();
This way when the user clicks or moves the mouse around you'll still be able to draw your UI, yet the user won't be able to use it until the dialog returns. Also he won't be able to change focus until the dialog return.
I know it's a bit lousy way, but that is what I can think of.
I hope it works
|
|
|
|
|
Hi Guru's
I recently moved from C++ to C# and so far, so good! But I do seem to have a little problem with displaying my reports designed with our good friend crystal reports! I am writing a simple Point Of Sale application for one of our clients, but I can't seem te send the reportviewer a SQL or "Format" string.
When the user selects the report he/she wants to see, I pop up a little dialog with a list that displays some invoice numbers. The user selects the invoice number and click on the "Print" button... and it displays the report... Brilliant!! BUT... with ALL the entries in my table!
How do I pass the invoice number to the report and have it display all entries of the selected invoice number only? In C++ I used to, grab the values from my little dialog, construct a SQL statement using those values, pass it to my report and display it! I am almost sure one should be able to do the same in C#.
Can anybody help me with this please!?
Many, MANY thanx!
Willem Le Roux
|
|
|
|
|
Willem_Le_Roux wrote: How do I pass the invoice number to the report and have it display all entries of the selected invoice number only?
You have an option in the report to set parameters. You can set a parameter and then you can send the parameter from the dialog box.
You could write a function like this
<br />
private ParameterField AddParameter (string paramName, string paramValue)<br />
{ <br />
ParameterField paramField= new ParameterField();<br />
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue ();<br />
ParameterValues paramValues = new ParameterValues ();<br />
paramField.ParameterFieldName = paramName; <br />
paramDiscreteValue.Value = paramValue;<br />
paramValues.Add (paramDiscreteValue);<br />
paramField.CurrentValues = paramValues;<br />
<br />
return paramField;<br />
}<br />
And to add a parameter
<br />
private CrystalDecisions.Windows.Forms.CrystalReportViewer crResults;<br />
crResults = new CrystalDecisions.Windows.Forms.CrystalReportViewer();<br />
<br />
rptMyReport crReportDocument = new rptMyReport();<br />
crResults.ReportSource = crReportDocument;<br />
<br />
CrystalDecisions.Shared.ParameterFields paramFields = crResults.ParameterFieldInfo; <br />
paramFields.Add(AddParameter("paramName",strValue)); <br />
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
-- modified at 9:19 Monday 26th June, 2006
|
|
|
|