|
Dear all,
Please help me ...
I want to add two datatable in dataset. I did as below code. when adatapter fill to 2nd table. It fill with first query statement.
So both table get same result.
Want to know how to get different result.
Dim acon As New SqlConnection(ConfigurationManager.ConnectionStrings("DOCDBDWHConnectionString").ConnectionString)
Dim acmd As New SqlCommand()
Dim sSql As String
acon.Open()
sSql = "select distinct vessel_code,vessel_desc from D4A_RAW_BLP"
acmd.Connection = acon
acmd.CommandText = sSql
'Pull vessel code
Dim dataset As New DataSet
Dim adpvsl As New SqlDataAdapter
Dim adpvoy As New SqlDataAdapter
adpvsl.SelectCommand = acmd
adpvsl.Fill(dataset, "Vessel")
'Pull voyageno
sSql = ""
sSql = "select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code from D4A_RAW_BLP where vessel_code<>'') order by vessel_code"
adpvoy.Fill(dataset, "voyage")
Thanks and best Regards
|
|
|
|
|
I bet if you look again, you'll spot what's wrong, and that the problem is that you've been staring at this too long. As you are aware, a string is an immutable object, so setting acmd.CommandText = sSql means that you get the value of sSql at the time you assign it. As you have only changed sSql for the voyageno, you will get the same results because you have issued the original query again. What you need to do is set the SelectCommand again, but this time to the new value of sSql.
BTW - you don't need the line sSql = "" .
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you!
Get result as your reply.
|
|
|
|
|
You're welcome.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi
In my page i write like this:
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",true);
But no popup window open ..is this right code?
|
|
|
|
|
Try following code.
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"Msg","<script>alert('Employee information is not valid...');</script>",false);
You were supplied last argument as true, which denotes that it will add script tag automatically.
While you already provided script tag.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I tried making last argument false as well but it still not giving the popup block
|
|
|
|
|
Are you trying to get that script executed when the page is sent back to the browser??
This question should really be asked in the ASP.NET forum.
|
|
|
|
|
Do You have AJAX Script Manager in your web page. If you then you need to use ScriptManager.RegisterClientScriptBlock .
|
|
|
|
|
ScriptManager is not necessary to inject script blocks into the page, even if you are using Ajax.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: ScriptManager is not necessary to inject script blocks into the page, even if you are using Ajax.
Agree Mark.
I just asked him to check if he has used scriptmanager then he need to use scriptmanager.register..
Yes, this is not necessary. But It can be used.
|
|
|
|
|
Is there a way to see the metadata of the assembly file ?
|
|
|
|
|
Use a tool called ILDASM.
Quidquid latine dictum sit, altum videtur.
Whatever is said in Latin sounds profound.
|
|
|
|
|
You can view it using this[^] Tool.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi everybody. Please I want to develop any type of website using the .NET Framework. I have the software installed on my notebook. Thanks and hope to receive a feedback sooner.
|
|
|
|
|
This[^] would be the best place to start.
It's time for a new signature.
|
|
|
|
|
Sean has done a very good job by compiling all the good resources for web development together.
So, check it out: Beginner's Walk - Web Development[^]
I am sure, it will help you.
..Go Green..
|
|
|
|
|
Following is the best link to get started with Asp.NET.
Get Started[^]
It covers following points.
1. What is ASP.NET?
2. Download ASP.NET and Visual Studio Express Tools (FREE)
3. Build your First ASP.NET Web Application
4. Follow a Step-By-Step ASP.NET Tutorial
5. Learn More about ASP.NET
6. Host your ASP.NET Web sites on the Web
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I have the task of deserializing objects from a binary formatter that were serialized using VB.Net's binary formatter. The ONLY issue I have come across is that the original class had a field, the same name as the class
structure MyName
...
dim MyName as String
end structure
In VB, this was apparently find, but in C#, I cannot write the class this way. I've rewritten it so that
struct MyName
{
...
string myName
}
but now the deserialization fails (because, I assume, the field name has changed). I have ONLY changed the name of the attribute. I guess this is enough to throw off the deserialization.
Is there away that I can fix this dynamically, or should I resort to the binary reader and parsing the binary file manually?
Thank you for any considerations you could throw my way.
Dave
|
|
|
|
|
I'm not sure it can be solved at all, but if it does, it probably will be based on SerializationBinder . Start Googling!
|
|
|
|
|
hi,
it might help using Attributes for Serialization like i.e.:
<br />
struct MyName<br />
{<br />
[XmlElement("MyName")]<br />
string myName;<br />
}<br />
|
|
|
|
|
Go back and read the OP again. He's using binary formatter, not XML.
|
|
|
|
|
ups my fault ^^
|
|
|
|
|
Hi guys, has anyone come across any scenario wherein you needed to merge one object with another object of same type, merging the complete object graph.
for e.g. If i have a person object and one person object is having first name and other the last name, some way to merge both the objects into a single object.
public class Person
{
public Int32 Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class MyClass
{
Person obj1 = new Person(); obj1.Id=1; obj1.FirstName = "Tiju";
Person obj2 = new Person(); ojb2.Id=1; obj2.LastName = "John";
obj1.MergeObject(obj2);
obj1.Id
obj1.FirstName
obj1.LastName
}
I had come across such type of requirement and I wrote an extension method to do the same.
public static class ExtensionMethods
{
private const string Key = "Id";
public static IList MergeList(this IList source, IList target)
{
Dictionary<string, object> itemData = new Dictionary<string, object>();
string temp = null;
foreach (object item in source)
{
temp = GetKeyOfRecord(item);
if (!String.IsNullOrEmpty(temp))
itemData[temp] = item;
}
foreach (object item in target)
{
temp = GetKeyOfRecord(item);
if (!String.IsNullOrEmpty(temp) && itemData.ContainsKey(temp))
itemData[temp].MergeObject(item);
else
source.Add(item);
}
return source;
}
private static string GetKeyOfRecord(object o)
{
string keyValue = null;
Type pointType = o.GetType();
if (pointType != null)
foreach (PropertyInfo propertyItem in pointType.GetProperties())
{
if (propertyItem.Name == Key)
{ keyValue = (string)propertyItem.GetValue(o, null); }
}
return keyValue;
}
public static object MergeObject(this object source, object target)
{
if (source != null && target != null)
{
Type typeSource = source.GetType();
Type typeTarget = target.GetType();
if (typeSource != null && typeTarget != null && typeSource.FullName == typeTarget.FullName)
if (typeSource.IsClass && !typeSource.Namespace.Equals("System", StringComparison.InvariantCulture))
{
PropertyInfo[] propertyList = typeSource.GetProperties();
for (int index = 0; index < propertyList.Length; index++)
{
Type tempPropertySourceValueType = null;
object tempPropertySourceValue = null;
Type tempPropertyTargetValueType = null;
object tempPropertyTargetValue = null;
if (propertyList[index].GetIndexParameters().Length == 0)
{
tempPropertySourceValue = propertyList[index].GetValue(source, null);
tempPropertyTargetValue = propertyList[index].GetValue(target, null);
}
if (tempPropertySourceValue != null)
tempPropertySourceValueType = tempPropertySourceValue.GetType();
if (tempPropertyTargetValue != null)
tempPropertyTargetValueType = tempPropertyTargetValue.GetType();
IList ilistSource = tempPropertySourceValue as IList;
IList ilistTarget = tempPropertyTargetValue as IList;
if (ilistSource != null || ilistTarget != null)
{
if (ilistSource != null)
ilistSource.MergeList(ilistTarget);
else
propertyList[index].SetValue(source, ilistTarget, null);
}
else if (tempPropertySourceValue != null || tempPropertyTargetValue != null)
{
if (tempPropertySourceValue != null)
tempPropertySourceValue.MergeObject(tempPropertyTargetValue);
else
propertyList[index].SetValue(source, tempPropertyTargetValue, null);
}
}
}
}
return source;
}
}
However, this works when the source property is null, if target has it, it will copy that to source.
IT can still be improved to merge when inconsistencies are there e.g. if FirstName="Tiju" and FirstName="John"
Any commments appreciated.
Thanks
TJ
|
|
|
|
|
Hi,
How does .net framework automatic updates?
Does windows update actually checks/updates .net framework or any .net application actually check any checks/updates?
I have .net application hosted via click once. On certain sites, the application is using lots of bandwidths (I guess it might checks for any updates!).
Thanks,
Divyesh
|
|
|
|