|
Thank your, I will give it a try in the Visual Basic forum.
I could not find a VS-forum. Guess you meant the VB-forum.
|
|
|
|
|
Hi,
I am using LINQ to SQL and MVVM pattern in my application where i am retrieving
my data by the following query:
internal ObservableCollection<INVCategory> GetCategoryList()
{
DataLoadOptions dataLoadOptions = new DataLoadOptions();
dataLoadOptions.LoadWith<INVCategory>(t => t.INVSubCategories);
this.Context.LoadOptions = dataLoadOptions;
var categories = from category in this.Context.INVCategories
orderby category.CatgeoryId descending
select category;
return new ObservableCollection<INVCategory>(categories.ToList());
}
And my XAML code for parent(Category) combo is:
<ComboBox Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,2,10,2" TabIndex="0" x:Name="categoryComboBox" ItemsSource="{Binding CategoryList}" IsEditable="True" DisplayMemberPath="CategoryName" SelectedValuePath="CatgeoryId" SelectedItem="{Binding CategoryList, Mode=TwoWay}" SelectedValue="{Binding Path=CurrentEntity.CategoryId, Mode=TwoWay}">
</ComboBox>
for child(Subcategory) combo i am using:
<ComboBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,2,10,2" TabIndex="1" ItemsSource="{Binding SelectedItem, ElementName=categoryComboBox, Mode=OneWay}" DisplayMemberPath="SubCategoryName" SelectedValuePath="SubCategoryId" SelectedItem="{Binding INVSubCategories, Mode=TwoWay}" >
</ComboBox>
But my child combo items is not populated during form loading as well as parent combo's
selection changed though my parent combo items are populated.
i can't figure out why my child combo is not functioning based on parent combo's
selected item ,please help me.
|
|
|
|
|
I think you are more likely to get an answer posting this on the WPF forum instead of the SQL forum.
But I experienced basically the same thing and finally wrote my own code the old-fashioned way to populate the child table. Though, looking at your XAML you've pretty much setup a logical binding between the two.
Good luck.
|
|
|
|
|
I was sitting out on my porch having lunch when I realized what your problem may be.
I remember there was a property (don't know it right now .. you'll have to search for the obvious in your XAML) which was basically binding to an event to tell the control when to rebind it's data. You need to find that property and bind it to the combobox SelectionChanged event.
|
|
|
|
|
hi iam using sql server 2000
i have table images
brabchid nvarchar(50)
imagenew image
imageold image
at the first time iam storing image in imagenew field then by using update querry i want to copy imagenew field data into imageold field and in imagenew field iam storing new image but it is showing same images can you correct my querry
update images set imageold=imagenew ,imagenew=@imagenew where branchid=@branchid
|
|
|
|
|
hi , sir iam waiting for your reply
|
|
|
|
|
Hi,
Could anybody tell me about Interbase database 6.0 driver's compatibility with different OS as (All Windows/Unix/Linux) based on practical experience,not based on information available on internet as it is not always correct.
Thanks & Regards
Navneet
|
|
|
|
|
I can only confirm that I currently run it on XP (SP3) but it has been on my system since the release of XP. So XP, XP (SP1), XP (SP2) are also all OK.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
I stored/retrieved images upto size 64 KB (65535 byte) using CByteArray.But it is not able to save whole image of size 2 MB, partially it saves upto 64 KB of total size 2 MB.
How to use CLongBinary to store image of size > 64 KB (upto 2 MB) with Interbase Database 6.0 driver?
Please provide me example specific to this database driver.
Database table structure is:
Create table "TEST"
(
"Name" varchar(10),
"BlobData" BLOB
);
I tried to check BLOB limit of database table as well.I run following queries on database:
Case 1:
Create table "TEST"
(
"Name" varchar(10),
"BlobData" BLOB(65535)
);
Result: Successfully created.
Case 2:
Create table "TEST"
(
"Name" varchar(10),
"BlobData" BLOB(65536)
);
Result: Dynamic SQL Error Error code -842 shown as: unsigned short integer expected.
So please help me to resove this problem.
Thanks & Regards
Navneet
|
|
|
|
|
Hello
I am trying to get from a mysql tables, all records from one table that do not have a corresponding ID in another, I am using the following query but I'm missing the plot somewhere.
SELECT tbl_band_songs.id3_artist, tbl_band_songs.Artist, tbl_band_songs.id, tbl_band_songs.id3_title
FROM tbl_band_songs, tbl_song_lyrics
WHERE tbl_band_songs.id3_artist = 239 AND tbl_band_songs.id <> tbl_song_lyrics.Sng_ID
Basically I am trying to show the user songs that have no lyrics already enetered so they then have the option to enter them.
Thank you in advance for any help.
regards
Ray
|
|
|
|
|
Never touched mysql in my life, but I think you're looking for NOT IN and a subquery.
SELECT tbl_band_songs.id3_artist, tbl_band_songs.Artist, tbl_band_songs.id, tbl_band_songs.id3_title
FROM tbl_band_songs, tbl_song_lyrics
WHERE tbl_band_songs.id3_artist = 239
AND tbl_band_songs.id NOT IN (SELECT tbl_song_lyrics.Sng_ID FROM tbl_song_lyrics)
|
|
|
|
|
You should do a left outer join from tbl_band_songs to tbl_band_lyrics and then select where tbl_song_lyrics.Sng_ID is null.
If you search on Google you will find plenty of examples that explain what an outer join is and how to code it to get the results you want.
|
|
|
|
|
|
My preference for these kinds of queries is to use NOT EXISTS in the where clause.
select your_field_list
from table_one t1
where not exists ( select t2.id
from table_two t2
where t2.id = t1.id
)
;
I've found this to usually be the most performant, though YMMV.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
I had an old boss who swore by this route, in favour of my NOT IN solution above. He said it was much more efficient.
He was right, and I forgot about that whole conversation till I saw your answer.
|
|
|
|
|
I have a table which is some thing like below..
Date ID
2009-07-01 1
2009-07-01 2
2009-07-01 3
2009-08-01 4
2009-08-01 5
2009-08-01 6
2009-09-01 7
2009-09-01 8
2009-10-01 9
2009-10-01 10
2009-11-01 11
....
Now I need to write a query which will show a output like below.
Date Start End
2009-07 1 3
2009-08 4 6
2009-09 7 8
...
How can I do this..
Any help would be highly appreciated
Thanking In Advance
Johnny
|
|
|
|
|
Thats about the easiest type of aggregate you can hope for. Simple MIN and MAX over a grouped set:
SELECT [date],
MIN([id]),
MAX([id])
FROM [YourTableName]
GROUP BY date
|
|
|
|
|
He doesn't want to group by date, he wants to group by month so it is a little more complicated.
(And before you ask, no, I don't know what the solution is.)
|
|
|
|
|
So he did, I missed that.
Still easy though:
SELECT MONTH(date),YEAR(date),
MIN([id]),
MAX([id])
FROM [YourTableName]
GROUP BY MONTH(date),YEAR(date)
and if you really must mash that first column back to the format he wanted
SELECT
CAST(YEAR(date) AS VARCHAR(4)) + '-' + CAST(MONTH(date) AS VARCHAR(2)),
MIN([id]),
MAX([id])
FROM [YourTableName]
GROUP BY MONTH(date),YEAR(date)
|
|
|
|
|
|
Hi,
Try this
SELECT DISTINCT d.Date1 as `ActionDate`, (SELECT MIN(ID) FROM dates WHERE Date1 = `ActionDate`) as `Start`, (SELECT MAX(ID) FROM dates WHERE Date1 = `ActionDate`) as `End` FROM dates d;
Happy Coding
<edit>This assumes table is called dates and date column is called date1
|
|
|
|
|
This gives the same result as mine above, but is far less readable and far less efficient.
Get friendly with the GROUP BY functionality of sql if you want to aggregate data.
|
|
|
|
|
Hi,
I wanna ask How can I verify that my TCP/IP connection to the server is working well???
My code is:
string sConnection = "Provider=SQLNCLI.1;Persist Security Info=False;User ID=sa;Initial Catalog=GMAO;Data Source=127.0.0.1,1433;Password=sa;";
string sSQL = "SELECT com FROM energie; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sSQL,conn);
SqlDataReader dr = null;
try
{
comm.Connection.Open();
da.Fill(ds, "SQL Temp Table");
foreach (DataRow d in ds.Tables[0].Rows)
{
MessageBox.Show("xxxx");
comboBox1.Items.Add(d.ItemArray[0].ToString());
}
}
catch (SqlException ex)
{
MessageBox.Show("connexion impossible");
MessageBox.Show(ex.Message);
return;
}
dr.Close();
comm.Connection.Close();
the error that must appears when connection is failed doesn't existe when running,IS it an indice that my connection goes well??
When googling,I found that the job activity monitor in the sql server management indicates that.is that true??how can I use that in checking my connection result???
Thanks
|
|
|
|
|
well firstly 127.0.0.1 is a ping back address..
to programatically ping an address have a look at this example ping example
what is the error message that you are getting?
Marc Clifton wrote: That has nothing to do with VB. - Oh crap. I just defended VB!
|
|
|
|
|
Hi,
I wanna explain to u something:First,I work with the defualt instance of sql server 2005.So the server availabe is:Admin-PC\MSSQLSERVER that indicates a local IP@=127.0.0.1,1433.Is that true or I am wrong in my behavior?
Second,what u mean by ping back @??
Third,bebore attaching my database,the error"Specified sql server not found or access denied"annoys me.after the attachemment,no exception appears(in the catch block of my code)but still my combobox not filled by data from database.
Thanks a lot
|
|
|
|