|
John Simmons / outlaw programmer wrote: Math operations are always faster/more efficient than string operations.
Unless you run out of fingers and toes, then have to resort to paper and pencil.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
lol true ... that works all the time but due to the fact that we are getting lazier everyday these things become vital in our lives ! don't u agree ?
|
|
|
|
|
Good Morning everybody,
I develop a csharp smart device application.I am in the step of the connection to my local database .sdf.As I read,I should add this .sdf file to my emulator using a shared folder.I did as below:
1-sharing my file C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile
2-in the visual studio,go to Tools->connect to device
3-in the device tool,Menu File->configure...
4-I add the shared file in the shared folders icon.
Running another time,the problem still the same:cannot found the path of the database.
I read more.I found that I can refer to my database using the storage card.But I can't Copy the DB (the sdf file) from the pc to the storage card, and, and refer to it as \\Storage card\GMAOMobile.sdf.
Any help will be very grantful
Regards
|
|
|
|
|
Tunisien86 wrote: But I can't Copy the DB
It would be helpfull if you stated why you can't copy the file. Did you receive an error?
It might be easier if you copy the CE-database to a shared folder on your device, as opposed to reading it from an occasionally-connected-drive. I suggest you dive into the documentation[^].
I are Troll
|
|
|
|
|
|
Tunisien86 wrote: Plzzzzzzzzzzz help me
I am really getting crazy
Save your SqlCe database on the SmartDevice itself, and point your connectionstring to it. That's also what's been suggested as an answer in the post that you are referring to;
conn = @"Data Source=\Program files\smartdeviceproject1\firstaid.sdf";
As you can see, there's no C:\ drive on a smart device. Your app will be deployes domewhere in the "Program Files" folder. I suggest you share that folder and copy your file there, and update your connectionstring accordingly.
I are Troll
|
|
|
|
|
|
Hello community!
I'm new here. My Question is:
Is it possible to create a TableAdapter programmatically or deliver it to an extern function?
The reason:
I want to create an Class Library which should take care of DataBase activities in my application.
One reason is a function i wrote that compares the loaded Row with the Row in DataBase before sending an Update-Command, which i want to use in all applications.
My consideration:
The Library contains an class "DBCaretaker". On creating this class, it receives the DataSet and the TableAdapters. After that, filling DataSets, Updating Tables and further actions will be executed by functions in this Library.
Is this possible? Or do you have an alternative proposal?
Greetings,
Robert
|
|
|
|
|
If you say:
public DataSet GetUsers()
{
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Users", connectionstring);
DataSet dataset = new DataSet();
adapter.Fill(dataset, "Users");
return dataset;
}
Here you would rather want to pass the dataset to extern function and make sure the
receiving function is requesting for a dataset to be returned e.g
DateSet datasetfromfrontend = NameOfClass.GetUsers();
This will return a dataset and you can check for tables e.g
DataTable table = datasetfromfrontend.Tables[0];
Good luck
|
|
|
|
|
This way i could go, but i wanted something little different:
I don't want to create an adapter with just one SELECT command, rather i would like to go on something like this:
<br />
public void myFunction(DataSet myDataSet, "TableAdapter" myTableAdapter)<br />
{<br />
}<br />
Or this:
<br />
public void myFunction(DataSet myDataSet)<br />
{<br />
"TableAdapter" myTableAdapter = myDataSetTableAdapterCollection.TableAdapter[0];<br />
}<br />
Then i could use all the SQL commands of this TableAdapter, and don't have to write them manually.
|
|
|
|
|
I want to load in application dataGrid 3TIER with SqlDataReader and code of C#?
thanks
|
|
|
|
|
Hey, could you be more specific about what you are planning to do ?
|
|
|
|
|
I would like to fill my datagrid from sql database in accordance with the principles of the n-tier architecture (DAL,BLL,UI), but I do not know how to do it in connected mode
|
|
|
|
|
Not quiet certain on the above 'principles' but try this:
try
{
string query = @"SELECT * FROM [contacts]";
conn.Close();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = query;
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
DataSet dataset = new DataSet();
DataTable table = dataset.Tables.Add();
table.Columns.Add("contactid", typeof(string));
table.Columns.Add("firstname", typeof(string));
table.Columns.Add("lastname", typeof(string));
table.Columns.Add("email", typeof(string));
while (reader.Read())
{
table.Rows.Add(reader["contact_id"].ToString(), reader["name"].ToString(), reader["surname"].ToString(), reader["email"].ToString());
}
if (dataset.Tables[0].Rows.Count > 0 || dataset.Tables.Count > -1)
{
contacts.DataSource = table;
contacts.DataBind();
contacts.Visible = true;
}
}
catch (SqlException fc)
{
error.Text = "Error occured :" + fc.Message;
}
finally
{
conn.Close();
}
Later
|
|
|
|
|
|
Hello All,
I have problem with regular expression. i have one string can any tell the regular expression for that string.
String text = AAAA!1234,BBBB;11111/CCCCC:2222/
In this string.
I want
1)the string between ! and , as a "Jobid" means 1234
2)the string between ; and / as a "Field1" means 11111
3)the string between : and / as a "Field2" means 2222
Can any one tell the regular expression for that string.
Thanks
Bhaskar
modified on Friday, April 16, 2010 6:31 AM
|
|
|
|
|
Do you need a regular expression?
Something like this might do.
char[] splitChars = {'!', ',', ';', '/', ':'};
string[] theBits = text.Split(splitChars);
foreach(string s in theBits)
{
}
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Thanks for ur reply,
I need the regular expression like this,
Regex rx = new Regex(@"(!(?<jobid>.*?),)(.*)(;(?<field1>.*?)/)(.*)( <field2>.*?)/)(.*)",RegexOptions.Compiled | RegexOptions.IgnoreCase);
in the above regular expression i am extracting the string based on the groups. but if one of the group is not present in the string. it is not matching.
example
"aaa!1234,BBBBCCCCC:222222/"
if the text is like this the regular expression is not matching.
|
|
|
|
|
To make a group optional, simply append the ? character to the group. This should do the trick:
@"(!(?<jobid>.*?),)?(.*)(;(?<field1>.*?)/)?(.*)(:(?<field2>.*?)/)?(.*)"
|
|
|
|
|
You can use a tool like Espresso to build your regular expressions. The link is http://www.ultrapico.com/Expresso.htm[^]
Here is the regex I came up with:
(?:!(?<JobId>\w*)(?:.*?),(?:.*?))?(?:;(?<Field1>\w*)?/??(?:.*?))?:(?<Field2>\w*)??/
Expresso will generate the following C# code for you:
<br />
<br />
public static Regex regex = new Regex(<br />
"(?:!(?<JobId>\\w*)(?:.*?),(?:.*?))?(?:;(?<Field1>\\w*)?/??(?"+<br />
":.*?))?:(?<Field2>\\w*)??/",<br />
RegexOptions.Multiline<br />
| RegexOptions.CultureInvariant<br />
| RegexOptions.Compiled<br />
);<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
I hope this helps. I wrapped each section in a non-capturing group with the ? option to account for cases where the field 1 may not be present.
|
|
|
|
|
5 from me!
I have been using Expresso for a year or so, and had never spotted it could generate the C# code! Admittedly, it's not an onerous job, but the comment generation is very handy! Thanks a lot - Friday has not been wasted for me: I've learned something new...
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Hello JTS
Thank u Very much, u helped me alot. once again thank u...
|
|
|
|
|
The best way you can ever sooth around validation expressions is to Try Me(Expresso)...
Good luck. 
|
|
|
|
|
Hi
I am working on some software that needs to be able to create videos from an array of images and I need to create the video as fast as possible. The requirements I have been given are that the software needs to be able to create 6 minute video at 640x480 resolution and 25 fps within about 5 - 10 seconds. Can anyone give me any advice or help?
Thanx
|
|
|
|
|
I don't think that can be done, it amounts to generating 1000 frames per second.
|
|
|
|