|
Dear All,
I am developing an application which communicates with database in web server.
my concern is followings
1. initate access from client or simply remote client.
2. execute a procedure which create an xml of select statement in server in a specific directory.
what i want is when the user initates access to web database, due to lack of internet connectivity the second phase has to be done offline.
What i have done yet, i have created a dll file, assembly and then created store procedure from that assembly which create xml file based on the select statement.
now i am searching for a method that the second option should be done offline, while the cient need to initiate access first.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi All,
i created a painter program, with classes and all shapes.
i save the shapes in arraylist for undo redo.
i tried to serialize the objects using the following code,
just to see if it works, and i get error
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PaintBrush
{
public class SaveBinary
{
FileStream fs = new FileStream("Data", FileMode.Create);
BinaryFormatter BF = new BinaryFormatter();
BF.Serialize(fs, "1234");
fs.Close();
}
}
it won't recognize BF at all, and i don't see why (using visual studio 2008)
Error on compile:
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\PaintBrush\PaintBrush\Serialize.cs(23,21): error CS1519: Invalid token '(' in class, struct, or interface member declaration
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\PaintBrush\PaintBrush\Serialize.cs(23,24): error CS1519: Invalid token ',' in class, struct, or interface member declaration
C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\PaintBrush\PaintBrush\Serialize.cs(24,17): error CS1519: Invalid token '(' in class, struct, or interface member declaration
Compile complete -- 3 errors, 0 warnings
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thanks,
Retaliator
|
|
|
|
|
Buy a very basic book on C#, preferably one with pictures, and read it.
alonchap wrote: public class SaveBinary
{
// Create file to save the data
FileStream fs = new FileStream("Data", FileMode.Create);
// Create binary formatter object:
BinaryFormatter BF = new BinaryFormatter();
BF.Serialize(fs, "1234");
fs.Close();
}
Can you honestly not see what's wrong here ? You're writing code inside the class declaration, but not inside a method. Your code is invalid, which is what the compiler told you.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hey i did not notice, just saw it now,
so it's working basiclly i can save a string now and deserialize as well,
how would i do a loop to serialize each object (class which is shape) inside the array list?
|
|
|
|
|
I would serialise the entire array, and then deserialise it as an array also.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Can you point how? coz it needed casting or something because it did not allow serialize the ShapesList (which is the arraylist)
|
|
|
|
|
The ArrayList class sucks, don't use it. I suspect if you use a generic list, it will work fine, b/c it is strongly typed and will know it's contents can be serialised. If not, just build an array, and serialise that.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
I Managed, thanks
modified on Saturday, June 6, 2009 5:08 PM
|
|
|
|
|
Hi,
This is my scenario. I have a Win32 console application and I would like to call functions in this project by a C# widows application. I have tried p/invoke but I seem to get an error saying that the entry point was not found. Added the C++ project to the C# solution but couldn't get it working. Any suggestions on how to get it working ?
Thanks in advance,
indikat
|
|
|
|
|
indikat wrote: I have tried p/invoke but I seem to get an error saying that the entry point was not found.
yeah - a console app doesnt expose 'entry points' (well, I guess you could call 'main' an entry point, but that doesnt help you )
it sounds like what you really need is to put the functions (assuming you have the source) from the console app into a dll. If you cant do that, then you need to do something like run the console app as a process and capture stdout etc to get the results back ..
'g'
|
|
|
|
|
I'll try and add the necessary functions into a dll. Is there any way that I can add the C++ project to the solution and use the C++ functions from C# project ?
indikat
|
|
|
|
|
not really, if you want to keep them in c or c++ - you must export them from a dll - or you could simply re-write them in c#
|
|
|
|
|
Thanks for the info. I have managed to create a dll and export the needed function.
Might need to rewrite the code in C# later on.
indikat
|
|
|
|
|
|
|
hi..i am doing a project named as news mangement system.it is mainly aimed at the content manipulation of a web news paper on the internet.the technology used are asp.net with c# using ajax,web services,sql server 2000.i am beginner and i need ur help to complete my project.i hope u will give me the suitable suggestions and helps to me.
|
|
|
|
|
You will find all the help you need here[^].
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hello,
I need to add datagridviewcolumns in a loop. For example:
string[] default_columns { "VlFile", "EquipName", "JobName", "NickName", "Operator", "EquipmentStartTime", "JobComment", "EquipTypeDesc" };
foreach (string s in default_columns)
{
}
The columns need to be bounded. I have the bound source and all this but the problem is adding the columns.
It will loop me through the array (default_columns) and will add this columns.
How can i do it?
I mean there is a problem because i need to declare a variable
|
|
|
|
|
I would create a datatable and point the datagridview to it
DataTable DT = new DataTable();
foreach (string s in default_columns)
{
DataColumn NewCol = new DataColumn(s);
DT.Columns.Add(NewCol);
}
DataGridView.DataSource = DT;
Regards
Mick Curley
|
|
|
|
|
OK but i load data to the datagridview from a database. And i need the columns to be bound to the database.
I declared the database (datatable) as a bindingsource to the datagridview.
But i need to add columns in the program (the user will choose which columns he wants to see)
|
|
|
|
|
I dont understand what your trying to do.
If you load the data from your Database table into a DataTable
haven't you got a reference to the columns within that DataTable?
Regards
Mick Curley
|
|
|
|
|
I have an empty datagridview (without columns declared- in the wizard of the datagridview).
The user choses which columns he wants to see from the database (using a listbox that i save the items in an array).
I want to add columns to the datagridview from this array (that was created from the listbox). The problem is that i need them to be bound to that datatable.
So i do in the foreach loop
datagridview.Columns.Add(s, s);
it creates me the columns right but they are not filled with data from the database.
If i do:
datagridviewcolumn col=new datagridviewtextboxcolumn();
col.headertext="abc";
col.datapropertyname="abc";
col.name="abc";
It does creates me the column and filles it with data.
But i need to do it in a loop that will go through all the items in the array (from the listbox) and add this columns
But i can use the same name to the datagridviewcolumn (datagridviewcolumn col=new datagridviewtextboxcolumn();), Because if i do it it says i already have this column (even if i change it's name in the loop)
|
|
|
|
|
I think i managed the problem. I had to declare the datagridviewcolumn
(datagridviewcolumn col=new datagridviewtextboxcolumn();)
inside the foreach loop (i declared it outside) and in this way it declares a ned datagridviewcolumn for each item in the loop.
|
|
|
|
|
Good to hear..
Regards
Mick Curley
|
|
|
|
|
okay i read the input from the text box as a char array.. then i've put if conditions that check for whitespaces, comments, strings, digits,
but it always skips which means that the comments then lie in the strings bit and so on...
please tell me where i went wrong here .
thankyou
#region Scanner
for (int i = 0; i < readInput.Length; i++)
{
char x = readInput[i];
#region Whitespace
if (char.IsWhiteSpace(x))
{
continue;
}
#endregion
#region stringliteral
else if (x == '"')
{
i++;
StringBuilder adder = new StringBuilder();
do
{x = readInput[i];
MessageBox.Show(x.ToString() + "testing");
adder.Append(x);
i++;
if (i == readInput.Length)
{
MessageBox.Show("WRONG");
break;
}
} while (x != '"' && i < readInput.Length);
whole.Add(adder);
}
#endregion
#region syntax
else if (char.IsLetter(x) || x == '_' && x!='"')
{
StringBuilder adder = new StringBuilder();
do
{
x = readInput[i];
MessageBox.Show(x.ToString() + "Letter Only");
adder.Append(x);
i++;
if (i == readInput.Length)
{
break;
}
} while ((char.IsLetter(x) || x == '_' && x!='"') && i < readInput.Length);
whole.Add(adder);
}
#endregion
#region digitliteral
else if (char.IsDigit(x))
{
StringBuilder adder = new StringBuilder();
do
{x = readInput[i];
MessageBox.Show(x.ToString() + "Is Digit");
adder.Append(x);
i++;
if (i == readInput.Length)
{
break;
}
}
while (char.IsDigit(x) && i < readInput.Length);
whole.Add(adder);
}
#endregion
#region comments
else if (x == '$')
{
i++;
x = readInput[i];
do
{
MessageBox.Show(x.ToString() + "testing comments");
i++;
if (i == readInput.Length)
{
MessageBox.Show("WRONG");
break;
}
x = readInput[i];
} while (x != '\n' && i < readInput.Length);
}
#endregion
}
#endregion
|
|
|
|