|
Thanks a lot! This was it
|
|
|
|
|
Hi,
I have a simple problem. All I need is a simple program that provides only tableName from Northwind Database.
What SQL Query should I write.
In the following code, I need to provide tableName (so that I can get DataSet object. I need to get a new tableName from
Northwind database at every iteration and pass the tableName to this method.
I need help.......
/****************************************/
private DataSet ReturnDataSet(tableName)
{
DataSet dataSet = null;
string sqlStatement = "select * from " + tableName;
try
{
using (SqlConnection sqlConnection = new SqlConnection(connectionInfo))
using (SqlCommand sqlCommand = new SqlCommand(sqlStatement, sqlConnection))
{
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
dataSet = new DataSet();
sqlDataAdapter.Fill(dataSet, tableName);
}
}
catch
{
//Log the exception.
}
return dataSet;
}//End ReturnDataSet
Sanjeev
Sanjeev
|
|
|
|
|
Sanjeev. From memory:
DataTable tbl = oleConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {"databaseName", null, null, null ));
The number of nulls might be wrong so you may want to experiment. I can't remember whether it's three or four nulls off the top of my head.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello John,
Thanks for your reply. May be I did not explain it right. I somehow need to write a program that gives me all the table Names of Northwind Database. At every iteration, I get different tableName from Northwind Database and pass the tableName to the above method to build DataSet object.
Thank you
Sanjeev
|
|
|
|
|
Sanjeev, I understood the question. The solution I presented was designed to retrieve the schema information (in this name tables) from the database. GetOleDbSchemaTable is used to retrieve various different schema.
BTW - my name's Pete. John is the name of the (in)famous John Simmons / Outlaw Programmer who I quote in my sig.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The webservice's are not ASP.Net Webservices but rather a remoteObject and its interface hosted on IIS. Just thought I would clarify that.
I have created plenty of WebServices this way to do database queries and such. But this time it is a bit different.
I have a client who will host their own Webservices via IIS and a remote app that also communicates through a webservice via IIS. What do I need for the two to communicate?
If my client webservice wanted to call a function on the servers Webservice would my client use the standard remoting code? example:
Reference the servers webservices' interface and in code do this to call:
<br />
robj =(RemoteInterface.IRemote)<br />
Activator.GetObject(typeof(RemoteInterface.IRemote),<br />
"http://" + ConfigurationSettings.AppSettings["IPAddress"] + "/AHN/AHN_WS.rem");<br />
try<br />
{<br />
<br />
HttpClientChannel theChannel = (HttpClientChannel)<br />
ChannelServices.GetChannel("http");<br />
theChannel.Properties["proxyName"] = null;<br />
}<br />
catch { }<br />
if this is the correct way to do it the server should use the same code to communicate with the clients webservice.
What the process flow will be is this:
Client app requests client data --- calls a function on the local(client ws) webservice -- 'client ws' then calls a function on the servers webservice(server ws) --- Server queried database to collect data --- populates an arraylist with data --- returns that arraylist back to 'client ws' --- 'client ws' then gives it back to the client app.
Hope that mades sense.
Am I on the right track or way off?
Thanks for the help
-- modified at 15:56 Friday 19th January, 2007
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
hi
i have a table t1 with some col c1,c2,c3.
and a winform with some textbox binded to those filds
via bindingsource and dataset.
filling , loading , navigating and deleting are works
but i dont know why ADDNEW dosnt work????
mey someone help me please..
thanks
|
|
|
|
|
Don't you have to provide SQL to do the update ? You may need to post some code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
i use all components needed in my winform:
dataset , datatable , bindingsource , bindingnavigator , textboxes
all commands in navigator work but the addnew command create a new row in bindingsource list and make it current and gets data from textboxes but it dosnt save the newrow data (current item ). dosnt attach added row to the bindingsource list.
|
|
|
|
|
ABBASI_RA wrote: bindingsource , bindingnavigator
I never use these. So, I can't really comment further, except that I think you need to specify SQL to save, and I've not seen your code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Migrating VB6 code to C#.....
VB6
Dim coefficients() As Double
coefficients = LeastFit(myData, order, False, 0, 0, 1)
c#
double[] coefficients;
coefficients = LeastFit(myData, order, false, 0, 0, 1);
The question is, is this OK in c#. It compiles OK but I'm assuming it will choke at run time because of the array size.
|
|
|
|
|
Why? What's wrong with the array size?
---
Year happy = new Year(2007);
|
|
|
|
|
double[] Yarray = new double[X]
The array size is missing. The array is being returned from the function.
|
|
|
|
|
Hello,
In this case the array instance is made in the method, so you dont have to care about the size of the array.
All the best,
Martin
|
|
|
|
|
Thanks Martin
I expected the compiler to cough...now I know why.
|
|
|
|
|
What you are declaring is only a reference to an array, and it's always declared without a size. The size is determined when the array object is created. For example:
double[] values;
values = new double[42];
---
Year happy = new Year(2007);
|
|
|
|
|
Guffa wrote: Year happy = new Year(2007);
I like
I have no idea what I just said. But my intentions were sincere.
Poore Design
|
|
|
|
|
You can also try to use Arraylists.
|
|
|
|
|
Is there a difference between the two?
|
|
|
|
|
getLength returns the total number of elements and getUpperBound returns the highest index number (getLength - 1) in most cases. getUpperBound can also be used on arrays of 2 or more dimensions to get the upper index of a dimension.
|
|
|
|
|
C++NewBe wrote: Is there a difference between the two?
Yes.
GetLength returns the number of items in the specified dimension.
GetUpperBound returns the index of the last item in the specified dimension.
For a one dimensional zero based array (which is the usual) that holds 10 items, GetLength(0) returns 10, while GetUpperBound(0) returns 9.
---
Year happy = new Year(2007);
|
|
|
|
|
Yes, GetUpperBound is used to get the boundaries of different dimensions of an array. Call GetUpperBound(0) to get the upper bound of the first dimension, GetUpperBound(1) for the second dimension and so on. It's in case you're using a 2-dimensional (or higher) array. Also, GetUpperBound returns the highest index of that array instead of the number of values in that array. So, whereas you would do for (int i = 0; i < arr.Length; i++) for length, you would do this for the upper bound: for (int i = 0; i <= arr.GetUpperBound(0); i++)
|
|
|
|
|
Thanks for the explanation guys....
|
|
|
|
|
Hey all,
I'm trying to create a working TypeConverter for a custom class, but it's causing me no end of problems. At the moment, everything seems to be working except for the code generation. Rather than initialising the objects in InitializeComponent, the designer is trying to do so via the Form's RESX file.
The relevant line in the InitializeComponent function looks like this;
this.graph1.Point = ((Root.Graph.GraphPoint)(resources.GetObject("graph1.Point")));
And in the RESX file, I have this;
<assembly alias="Graph" name="Graph, Version=1.0.0.39852, Culture=neutral, PublicKeyToken=null" />
<data name="graph1.Point" type="Root.Graph.GraphPoint, Graph">
<value>5, 3, 2, 1</value>
</data>
It doesn't actually compile by the way - it seems to break the RESX file. But that's not the issue. Does anyone have a clue as to why it might be serializing my object in the RESX file, and not just initializing it as normal in InitializeComponent?
Thanks.
|
|
|
|
|
hi
i want to create a player that play video files via streaming. but how to do that ? i must use directx or wmp SDK ..? can
any one help me ?
thaks
|
|
|
|