|
I'm pretty sure that you could Google this, the pros and cons of CLR stored procedures can easily be found.
|
|
|
|
|
I am attempting to rewrite a program using SqlCE database vs an OleDb database. The code below worked using OleDb, but now throws a System.Argument exception.
SqlCeCommand GetAcctsCmd = new SqlCeCommand("SELECT ACCTSTORE, ACCTMGR, Count(ACCTMGR) AS [CountOfACCTMGR] FROM ALLACCOUNTS WHERE (DATEDIFF(d, ACCTNEXTDUE, @TESTDATE) > 0 )";
GetAcctsCmd.Parameters.Add("@TESTDATE", SqlDbType.DateTime);
GetAcctsCmd.Parameters["@TESTDATE"].Value = dtPD;
The exception is being thrown on the last line of code above. dtPD is a DateTime.
What am I missing?
Thanks in advance.
Jude
|
|
|
|
|
A close bracket...
SqlCeCommand GetAcctsCmd = new SqlCeCommand("SELECT ACCTSTORE, ACCTMGR, Count(ACCTMGR) AS [CountOfACCTMGR] FROM ALLACCOUNTS WHERE DATEDIFF(d, ACCTNEXTDUE, @TESTDATE) > 0 ");
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Sorry, I missed that on my cut and paste. The close bracket is there.
Jude
|
|
|
|
|
I would be curious to know your copy & paste technic, then
while (!working) {
Reboot();
}
|
|
|
|
|
What version of the SqlCE libraries are you using, and what's the exception message?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ver 3.5.1, Runtime ver 2.0.50727
Message=System.ArgumentException: Date
Jude
|
|
|
|
|
Isn't there also a message description that tells details? I've never seen an exception that just says "Date".
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Are you sure you're passing SqlDbType.DateTime to the Parameters.Add method, and not SqlDbType.Date ? The only place I can see that would throw an ArgumentException with a message of "Date" is if you're passing an unsupported SqlDbType value in:
internal static SqlCeType FromSqlDbType(SqlDbType type)
{
for (int index = 0; index < SqlCeType._AllTypes.Length; ++index)
{
if (type == SqlCeType._AllTypes[index].SqlDbType)
return SqlCeType._AllTypes[index];
}
throw new ArgumentException(type.ToString());
}
This error message has been improved in v4 of the SqlServerCe library.
If that's not the problem, can you post the stack-trace of the exception?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Are you sure that dtPD is a DateTime? Or is it rather a DateTimePicker? Or a string conatining a formatted datetime value?
|
|
|
|
|
|
|
|
|
|
|
|
I am trying to build a webpage that connects to a Exchange 2010 server and creates a mailbox for the user name I enter. How ever I am unable to find any help to do this From few of the sites I understand that I need to use powershell to get this done. And all the samples have System.Management.Automation namespace used but for some reason I am unable to add this to my project.
Is powershell the only way to get this done or is there a better option out there?
Any help with regards to this is greatly appreciated.
Thanks,
Arun
|
|
|
|
|
Hi,
I have two repeaters Repeater1(parent repeater) and Repeater2 (nested repeater). The Repeater1 has two labels and Repeater 2 as shown.
<asp:Repeater runat="server" ID="Repeater1" OnItemCommand="Repeater1_ItemCommand" OnItemDataBound="Repeater1_ItemDataBound">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Category" runat="server" Font-Bold="true"><%# DataBinder.Eval(Container.DataItem,"Category").ToString().Trim()%></asp:Label>
<asp:Label ID="Description" runat="server" Font-Bold ="true"><%# DataBinder.Eval(Container.DataItem,"Description").ToString().Trim() %></asp:Label>
<asp:Repeater runat="server" id="Repeater2" OnItemCommand="Repeater2_ItemCommand" OnItemDataBound="Repeater2_ItemDataBound">
<HeaderTemplate >
</HeaderTemplate>
<ItemTemplate>
<asp:label ID="CatDesPriceRange" runat="server" Font-Bold="true" Font-Underline="true"><%# DataBinder.Eval(Container.DataItem,"PriceRanges").ToString().Trim() %></asp:label>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
Now I want to use Category and Description label values as a parameters for the sql query for Repeater2. How do I get those values? Please help.
The code I am using is below :
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetCateDescription();
}
}
public void GetCateDescription(string stuID)
{
SqlCommand cmdList = new SqlCommand("Select distinct Category,Description from Records", cnx);
cmdList.CommandType = CommandType.Text;
DataSet ds = new DataSet();
SqlDataAdapter objDA = new SqlDataAdapter(cmdList);
objDA.Fill(ds, "Category");
Repeater1.DataSource = ds;
Repeater1.DataBind();
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (cnx.State == ConnectionState.Closed)
{
cnx.Open();
}
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
Label Category = e.Item.FindControl("Category") as Label;
Repeater Repeater2 = e.Item.FindControl("Repeater2") as Repeater;
Repeater2.DataSource = showAllPrices(Category.Text);
Repeater2.DataBind();
}
}
But the problem is I am getting label empty..Please help.
Dhyanga
modified 26-Feb-14 15:33pm.
|
|
|
|
|
hi,
I 've two assumptions, not sure what will fix you issues,
01. Try having a hidden variable after the label, and try getting the value from hidden Label
02. in Repeater1_ItemDataBound, rather than using e.Item.FindControl, you can do
Repeater1.Items[e.Item.ItemIndex].FindControl("Category")- try this once
Thanks
Mouli
Mouli
|
|
|
|
|
Hidden variable worked well..
Dhyanga
|
|
|
|
|
How to match image stored in database with captured image using webcam in c#.net
|
|
|
|
|
|
private void button1_Click_1(object sender, EventArgs e)
{
List<string> images = new List<string>() { "GreyA.png", "YellowA.png", "AOutline.png" };
AForge.Imaging.Filters.Edges filter = new AForge.Imaging.Filters.Edges();
foreach (var filename in images)
{
Bitmap b = new Bitmap(Image.FromFile(Path.Combine(Application.StartupPath, "images", filename)));
Bitmap filteredBitmap = b.Clone() as Bitmap;
PictureBox pb = new PictureBox();
pb.SizeMode = PictureBoxSizeMode.AutoSize;
pb.Image = b;
flowLayoutPanel1.Controls.Add(pb);
pb = new PictureBox();
// apply the filter
filter.ApplyInPlace(filteredBitmap);
pb.SizeMode = PictureBoxSizeMode.AutoSize;
pb.Image = filteredBitmap;
flowLayoutPanel1.Controls.Add(pb);
}
}
for more info visit- http://stackoverflow.com/questions/14128847/image-matching-algorithm-in-c-sharp[^]
Mouli
|
|
|
|
|
Also be a little more specific: what's the purpose of that comparison? Find out that the person is really John Doe, find out who the person is (oh that's really something totally different, do you understand that?), identify object types by their (fixed) shape at different angles, etc...
|
|
|
|