|
You have to write the Select command for the data adapter so it knows what fields to pull out of the database. If you are using Visual Studio then just drag and drop a DataAdapter onto you form and it wil open a wizard. Follow the prompts and the select command will be created for you along with Update, Delete and Insert statements, as long as you specify the primary key for your data.
If you are not using visual studio then you will have to create the SQL statements for selecting and updating the data required and assign them to the relevant properties of your DataAdapter
Kev Pearman MCP
|
|
|
|
|
Im useing VS .NET 7.1, I didnt get a wizard when I did that, but it did put the adapter there.. is there a howto on setting up these commands properly?
Thanks
|
|
|
|
|
I'm sure there's plenty of info out there about setting up the command properties of a DataAdapter but i really couldn't tell you where. Try MSDN or search the forums for something.
If that doesn't work then try reposting at the front of the forums and ask specifically for help on setting up DataAdapters Command properties, i'm sure someone will have a link to a document you could use.
Kev Pearman MCP
|
|
|
|
|
Thanks exhaulted I got it to post to the datagrid now.. However now im running into a problem with insert and update lol..
Thanks again for helping me with the other end
|
|
|
|
|
Simple question:
After using this window plus the Watch window in VB(6,.net) using functions like substring, indexof, trim around variables like
?var.Substring(0,1) IN C# I get the error(s) for ALL functions (out of scope, does not exist,etc.) There must be a way out of this, besides having to break the routine, put a debug statement around the variable, recompile and watch!!! ARGH!
HELP
|
|
|
|
|
yeah, these function are not in C# as VB 6.0 for sure.
you can debug by puting a break point anywhere, you have the watch window, locals and autos.
|
|
|
|
|
I'm dumbfounded!!
You mean, if I want to experiment on the fly with some parsing problem, I can only do this after a compile??? and not real time?? What a huge disadvantage...
How do you work out the kinks without pulling your hair out....
Even setting a watch to let's say val.Trim(), throws and error!!! but I would presume that foo=bar.Trim()
watch on foo won't!!!
Awful!
|
|
|
|
|
yeah, life isn't easy!
why don't you save the day and post some VB code and i'll help you translating it to C#.
becuase i really don't know where i should start to help you.
|
|
|
|
|
I think I'll build an Add-In
|
|
|
|
|
Hi,
I want to do that my program reads data from version1.mdb file and write the same data to the version2.mdb by using C#.net but I am new and dont know how todo this.
I want to hold the data at first by a recordset after reading from version1.mdb and to write to the version2.mdb file.
please help me, thanks
|
|
|
|
|
All you need to do is read the data from version1 into your DataSet using a DataAdapter .
Create a second DataAdapter and point it at the second database.
call the DataAdapter2.Update method specifying your Dataset as the source to update from.
DataAdapter2.Update(DataSet);
As long as both of the databases have the same structure and you have a primary key defined in each you shouldn't have too many problems.
Hope that helps.
Kev Pearman MCP
|
|
|
|
|
Hi,
I am trying to use a class from two different assemblies. This class is contained in the same namespace in the assemblies. These assemblies are referenced in the same project and I want to be able to use both classes.
Ex:
MyClass is under MyNamespace namespace in Assembly1.dll
MyClass is under MyNamespace namespace in Assembly2.dll
Assembly1.dll and Assembly2.dll are referenced in MyProject project. How can I use MyClass class from both assemblies.
Best Regards
|
|
|
|
|
Try the following
<br />
Assembly1.MyClass class1 = new Assembly1.MyClass();<br />
Assembly2.MyClass class2 = new Assembly2.MyClass();<br />
If you fully qualify your references to the namespaces you should be fine.
Kev Pearman MCP
|
|
|
|
|
Lol those are the assembly names, not the namespaces. He mentions both reside in the same namespace, called MyNamespace.
top secret xacc-ide 0.0.1
|
|
|
|
|
:-ODoh! Now i feel stupid!
Kev Pearman MCP
|
|
|
|
|
|
The posts are all yours now, dinner times over so i gotta get back to it
Kev Pearman MCP
|
|
|
|
|
Do you want to use them as the same class? Then you are out of luck!
Do you want to just reference them? Then redesign your classes and let them at least half decent/different names.
If you really wanna use them like that, they way you explain, you will have to resort to reflection as the C# compiler cannot handle such ambiguities.
top secret xacc-ide 0.0.1
|
|
|
|
|
I just wanted to try if there is a way to do that. But you are right. In my case I just can't change the classes at all. It seems that I will have to write a small application to use the other version.
Thanks again.
|
|
|
|
|
Hi, guys. I set the control textBox as Multiline true. And I want change the text line with such way"Contents.\n in the box". But "\n" didn't change a new line instead of displaying an error character. What 's the reson? And how can I can realize changing a new in my code?
Thanks a lot
vigorous
|
|
|
|
|
wk_vigorous wrote:
And I want change the text line with such way"Contents.\n in the box". But "\n" didn't change a new line instead of displaying an error character.
Try \n\r
wk_vigorous wrote:
And how can I can realize changing a new in my code?
That makes no sense. If you want to find out when the text changes, you can handle the TextChanged event.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
Try \r\n , please.
I used \n\r before , but it didn't change.
I don't know the cause.
hello ALL..^^
|
|
|
|
|
Hy everyone!
I do want to overide the red cross for closing in my Windows.Form.
I managed to do so by using e.Cancel=false in my code but well then it cancels every closecommand, meaning it cancels my command for closing via a button or via the menuitem of my trayicon.
Well what I want to do is:
If the user clicks the read cross (WinXP Style!) then the minimize operation is called. If the user clicks the button "Close" (on my Form) the the application is quit and if the user selects "Close" from my contextmenu of the trayicon then the application quits as well.
But well how do I separate these three events, so the last two really close my application and the first one minimizes?
Thanks!
Stephan.
|
|
|
|
|
Stephan, in the button.click event use Application.Exit() instead of MyForm.Close()
Kev Pearman MCP
|
|
|
|
|
Thanks!
It works!
Stephan.
|
|
|
|