Showing newest 67 of 636 posts from October 2008. Show older posts
Showing newest 67 of 636 posts from October 2008. Show older posts

Friday, October 31, 2008

[DotNetDevelopment] Re: Debugging error with insert statement

Thanks. I have my insert code set up now using parameters however
when I debug it gives me the error "must declare variable empl". I
have empl declared so I'm not sure why it is giving me this error.
Also, the value of my parameter 'glacct' needs to come my textbox
control 'GLacct"; however it will not let me put "glacct.text" for the
value...how do I assigned the value of this parameter to my textbox
control. Here is my code:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim oConn As New
System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("CMSConnectionString").ConnectionString)
Dim sql As New System.Data.SqlClient.SqlCommand()
Dim cmd As New System.Data.SqlClient.SqlCommand("sql", oConn)
Dim empl As Decimal = EmplID1.Text
Dim wedate As Decimal = 20081030
Dim wkno As Decimal = DD_week.SelectedValue
Dim dywk As Decimal = DD_DayofWeek.SelectedValue
Dim job As String = jobno.Text
Dim glacct As Decimal = glacct
Dim costcode As String = DD_CostCode.SelectedValue
Dim reghrs As Decimal = reghrs
Dim othrs As Decimal = othrs
Dim othhrs As Decimal = othhrs
Dim oth_type As String = DD_OthHourType.SelectedValue


sql.Connection = oConn
oConn.Open()
cmd.Parameters.AddWithValue("empl", empl)
cmd.Parameters.AddWithValue("wedate", wedate)
cmd.Parameters.AddWithValue("wkno", wkno)
cmd.Parameters.AddWithValue("dywk", dywk)
cmd.Parameters.AddWithValue("job", job)
cmd.Parameters.AddWithValue("glacct", glacct)
cmd.Parameters.AddWithValue("costcode", costcode)
cmd.Parameters.AddWithValue("reghrs", reghrs)
cmd.Parameters.AddWithValue("othrs", othrs)
cmd.Parameters.AddWithValue("othhrs", othhrs)
cmd.Parameters.AddWithValue("oth_type", oth_type)

sql.CommandText = "INSERT into
Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
INOVHR, INOTHR, INOTTY)
values(@empl,@wedate,@wkno,@dywk,@job,@glacct,@costcode,@reghrs,
@othrs,@othhrs,@oth_type)"
sql.ExecuteNonQuery()
oConn.Close()


End Sub

Thanks.

On Oct 31, 10:02 am, CK <c...@cksiteoftreats.co.uk> wrote:
> change your sql statement to be:
>
> "INSERT into
> Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> INOVHR, INOTHR, INOTTY) values(@ineeno, @indtwe, @inwkno... etc)"
>
> Then do the following:
> cmd.Parameters.Add(new SqlParameter("@ineeno", EmplID1.Text))
>
> for each parameter (this may not be the right VB syntax, am a C# guy)
>
> On 31 Oct, 14:53, Imstac <imsta...@gmail.com> wrote:
>
>
>
> > I've been looking for the proper code to use to use parameters in my
> > insert statement but am not having any luck.  Could you suggest a
> > website for me to get this information?  Also, should I be using a
> > dataset instead of accessing my database directly?  I'm not sure of
> > the guidelines on when you should/shouldn't use a dataset.
>
> > On Oct 30, 5:14 pm, Joe Enos <j...@jtenos.com> wrote:
>
> > > First of all - classic sql injection attack-prone - switch to a
> > > parametrized command or stored proc.
>
> > > Second - shouldn't be difficult to debug - just step through it, find
> > > out what the value of cmd.CommandText is, and dump it into your
> > > database program - Management Studio or Query Analyzer, etc.  You'll
> > > probably find a missing single-quote or something like that.
>
> > > On Oct 30, 3:09 pm, Imstac <imsta...@gmail.com> wrote:
>
> > > > I added an SQL insert statement to a button on my web form and when I
> > > > debug I get the error: "Incorrect syntax near ','  "  I've been over
> > > > and over the code and can't figure out the problem.  Could someone
> > > > please take a look at my code and let me know if you see anything
> > > > wrong?
>
> > > > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > > > System.EventArgs) Handles Button1.Click
> > > >         Dim oConn As New
> > > > System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(­­­"CMSConnectionString").ConnectionString)
> > > >         Dim cmd As New System.Data.SqlClient.SqlCommand()
> > > >         cmd.Connection = oConn
> > > >         oConn.Open()
> > > >         cmd.CommandText = "INSERT into
> > > > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > > > INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> > > > DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> > > > & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> > > > "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> > > > DD_OthHourType.Text & "')"
> > > >         cmd.ExecuteNonQuery()
> > > >         oConn.Close()
>
> > > >     End Sub- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] cross thread operation not valid

i get a error cross thread operation not valid when it is trying to
write to the textfield.
void appendToTextBox(string str){


i have a feeling that the delegates run in a different thread and when
the events are triggered, they are trying to write to the form thread.
i guess C# does not like it. how do i fix it.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Krs.Ats.IBNet;

using Krs.Ats.IBNet.Contracts;

namespace collectTickData
{
public partial class Form1 : Form
{
private static IBClient client;

public Form1()
{
InitializeComponent();
}
private void appendToTextBox(string str){
textBox1.Text += str + "\r\n";

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
client = new IBClient();
client.ThrowExceptions = true;
client.Error += client_Error;
client.TickPrice += client_TickPrice;
client.TickSize += client_TickSize;
Console.WriteLine("Connecting to IB.");
client.Connect(textBox1.Text, Int32.Parse(textBox2.Text),
10);
//Forex Test
Forex EUR = new Forex("EUR", "USD");
client.RequestMarketData(17, EUR, null, false);

}
void client_TickSize(object sender, TickSizeEventArgs e)
{
appendToTextBox("Tick Size: " + e.Size + " Tick Type: " +
EnumDescConverter.GetEnumDescription(e.TickType));
}

void client_Error(object sender, ErrorEventArgs e)
{
appendToTextBox("Error: " + e.ErrorMsg);
}

void client_TickPrice(object sender, TickPriceEventArgs e)
{
appendToTextBox("Price: " + e.Price + " Tick Type: " +
EnumDescConverter.GetEnumDescription(e.TickType));
}


}
}

[DotNetDevelopment] Re: write to a form textbox from static method

You pass a reference to it the same way as you pass any other parameter to the method.  Just add an additional parameter for the text box.
 
...Glenn

On Fri, Oct 31, 2008 at 2:00 PM, Dickery1 <junkone1@gmail.com> wrote:

i am pretty green to c#. can u provide an example or a link on how to
pass reference to the form or textbox.
appreciate ur help

[DotNetDevelopment] Re: write to a form textbox from static method

gotcha. thank you very much

On Oct 31, 2:04 pm, Joe Enos <j...@jtenos.com> wrote:
> Your code must start somewhere non-static - for example, a
> button_click event handler.  From there, you can call a static method
> and just pass the thing in.
>
> Suppose the following:
> You have a textbox with ID txt1.  The code gets started by clicking
> btn1.
> public void btn1_Click(object sender, EventArgs e)
> {
>   DoSomething(txt1);}
>
> public static void DoSomething(TextBox textBox)
> {
>   textBox.Text = "AAA";
>
> }
>
> Working with the form is a little different - if you can stick with
> the textbox only, that will be the easiest and probably the most
> readable.
>
> On Oct 31, 11:00 am, Dickery1 <junko...@gmail.com> wrote:
>
>
>
> > i am pretty green to c#. can u provide an example or a link on how to
> > pass reference to the form or textbox.
> > appreciate ur help
>
> > On Oct 31, 1:48 pm, Joe Enos <j...@jtenos.com> wrote:
>
> > > You can't access an instance's textbox from a static method - the
> > > static method does not even know whether or not an instance of the
> > > form even exists, let alone which one is calling it.
>
> > > If you can change your static methods so their not static, that would
> > > be best - or you can pass the reference to the textbox (or the form
> > > itself) around as a parameter, then you'll be able to access it.
>
> > > On Oct 31, 10:42 am, Dickery1 <junko...@gmail.com> wrote:
>
> > > > i have issues in writing to a textbox from static method
> > > >         private  static void appendToTextBox(string str){
> > > >             Form1.textBox1.Text  += str + "\r\n";
>
> > > >         }
>
> > > >         An object reference is required for the nonstatic field, method, or
> > > > property 'collectTickData.Form1.textBox1'
>
> > > > how do i fix it. aparrently all the mehods calling appendToTextBox are
> > > > static and so i made it static too.
> > > > appreciate any help.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Customizing Gridview Control

I have the following GridView Control:

<asp:GridView
id='personalView'
DataSourceId="personalSrc"
AutoGenerateColumns="false"
OnSelectedIndexChanged="grdEmployees_SelectedIndexChanged"
Runat='server'>
<Columns>
<asp:CommandField ShowSelectButton="true"
SelectText="Details" ShowDeleteButton="true" />
<asp:BoundField DataField="Full Name" HeaderText="Full Name" />
<asp:BoundField DataField="Title" HeaderText="Title" />
</Columns>
</asp:GridView>

How would you customzie the Gridview so as to show hyperlink to some
arbitrary page in each "Full Name" data cell as well? I tried setting
text to <asp:link....>

[DotNetDevelopment] Re: write to a form textbox from static method

Your code must start somewhere non-static - for example, a
button_click event handler. From there, you can call a static method
and just pass the thing in.

Suppose the following:
You have a textbox with ID txt1. The code gets started by clicking
btn1.
public void btn1_Click(object sender, EventArgs e)
{
DoSomething(txt1);
}
public static void DoSomething(TextBox textBox)
{
textBox.Text = "AAA";
}

Working with the form is a little different - if you can stick with
the textbox only, that will be the easiest and probably the most
readable.

On Oct 31, 11:00 am, Dickery1 <junko...@gmail.com> wrote:
> i am pretty green to c#. can u provide an example or a link on how to
> pass reference to the form or textbox.
> appreciate ur help
>
> On Oct 31, 1:48 pm, Joe Enos <j...@jtenos.com> wrote:
>
> > You can't access an instance's textbox from a static method - the
> > static method does not even know whether or not an instance of the
> > form even exists, let alone which one is calling it.
>
> > If you can change your static methods so their not static, that would
> > be best - or you can pass the reference to the textbox (or the form
> > itself) around as a parameter, then you'll be able to access it.
>
> > On Oct 31, 10:42 am, Dickery1 <junko...@gmail.com> wrote:
>
> > > i have issues in writing to a textbox from static method
> > >         private  static void appendToTextBox(string str){
> > >             Form1.textBox1.Text  += str + "\r\n";
>
> > >         }
>
> > >         An object reference is required for the nonstatic field, method, or
> > > property 'collectTickData.Form1.textBox1'
>
> > > how do i fix it. aparrently all the mehods calling appendToTextBox are
> > > static and so i made it static too.
> > > appreciate any help.- Hide quoted text -
>
> > - Show quoted text -
>
>

[DotNetDevelopment] Re: write to a form textbox from static method

i am pretty green to c#. can u provide an example or a link on how to
pass reference to the form or textbox.
appreciate ur help

On Oct 31, 1:48 pm, Joe Enos <j...@jtenos.com> wrote:
> You can't access an instance's textbox from a static method - the
> static method does not even know whether or not an instance of the
> form even exists, let alone which one is calling it.
>
> If you can change your static methods so their not static, that would
> be best - or you can pass the reference to the textbox (or the form
> itself) around as a parameter, then you'll be able to access it.
>
> On Oct 31, 10:42 am, Dickery1 <junko...@gmail.com> wrote:
>
>
>
> > i have issues in writing to a textbox from static method
> >         private  static void appendToTextBox(string str){
> >             Form1.textBox1.Text  += str + "\r\n";
>
> >         }
>
> >         An object reference is required for the nonstatic field, method, or
> > property 'collectTickData.Form1.textBox1'
>
> > how do i fix it. aparrently all the mehods calling appendToTextBox are
> > static and so i made it static too.
> > appreciate any help.- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: write to a form textbox from static method

You can't access an instance's textbox from a static method - the
static method does not even know whether or not an instance of the
form even exists, let alone which one is calling it.

If you can change your static methods so their not static, that would
be best - or you can pass the reference to the textbox (or the form
itself) around as a parameter, then you'll be able to access it.

On Oct 31, 10:42 am, Dickery1 <junko...@gmail.com> wrote:
> i have issues in writing to a textbox from static method
>         private  static void appendToTextBox(string str){
>             Form1.textBox1.Text  += str + "\r\n";
>
>         }
>
>         An object reference is required for the nonstatic field, method, or
> property 'collectTickData.Form1.textBox1'
>
> how do i fix it. aparrently all the mehods calling appendToTextBox are
> static and so i made it static too.
> appreciate any help.

[DotNetDevelopment] write to a form textbox from static method

i have issues in writing to a textbox from static method
private static void appendToTextBox(string str){
Form1.textBox1.Text += str + "\r\n";

}

An object reference is required for the nonstatic field, method, or
property 'collectTickData.Form1.textBox1'

how do i fix it. aparrently all the mehods calling appendToTextBox are
static and so i made it static too.
appreciate any help.

[DotNetDevelopment] Re: ADO Server issue

Hi,

I modified the LMhost file on a recommendation that it might fix it..
it didn't. The DNS is working fine, and the user can ping from the
machine and have it resolve the name correctly. The issue only occurs
when an ADO connection is used..

Thanks for your reply

Mike

On 29 Oct, 18:51, KeidrickP <keidri...@gmail.com> wrote:
> check the DNS on the machine that you are having issues connecting with.
> Why are you using LMhost files? This is considered "legacy" or an obselete
> technology.
>
> On Wed, Oct 29, 2008 at 11:29 AM, KoldKay <koldkompr...@gmail.com> wrote:
>
> > Hi all,
>
> > I have a problem.  I have several bespoke applications that I have
> > built and maintain across a small company of 35 people.
>
> > I have a user who cannot connect to a SQL Server 2008 using an ADO
> > Connection, if it uses a host name.  This is specific to the user and
> > computer.  If the user logs onto another computer, they do not have an
> > issue and the connection string works fine.  If another user logs onto
> > their connection, the ADO connection also works fine.
>
> > To clarify what I mean by "If it uses a host name", if the connection
> > string is:
> > "ODBC;DRIVER=SQL Server;SERVER=SQL1;" (etc) it does not work, but if I
> > use the IP address of the server, ie, "ODBC;DRIVER=SQL
> > Server;SERVER=192.168.2.102;" it works.
>
> > I have modified the hosts file and lmhosts.sam file to point SQL1 to
> > the IP Address, and I am able to ping SQL1 to get the IP address.
>
> > I can also access this server from the computer.
>
> > Any previous experience or help on this would be appreciated
>
> > Thank you
>
> > Mike

[DotNetDevelopment] Re: Debugging error with insert statement

change your sql statement to be:

"INSERT into
Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
INOVHR, INOTHR, INOTTY) values(@ineeno, @indtwe, @inwkno... etc)"

Then do the following:
cmd.Parameters.Add(new SqlParameter("@ineeno", EmplID1.Text))

for each parameter (this may not be the right VB syntax, am a C# guy)

On 31 Oct, 14:53, Imstac <imsta...@gmail.com> wrote:
> I've been looking for the proper code to use to use parameters in my
> insert statement but am not having any luck.  Could you suggest a
> website for me to get this information?  Also, should I be using a
> dataset instead of accessing my database directly?  I'm not sure of
> the guidelines on when you should/shouldn't use a dataset.
>
> On Oct 30, 5:14 pm, Joe Enos <j...@jtenos.com> wrote:
>
>
>
> > First of all - classic sql injection attack-prone - switch to a
> > parametrized command or stored proc.
>
> > Second - shouldn't be difficult to debug - just step through it, find
> > out what the value of cmd.CommandText is, and dump it into your
> > database program - Management Studio or Query Analyzer, etc.  You'll
> > probably find a missing single-quote or something like that.
>
> > On Oct 30, 3:09 pm, Imstac <imsta...@gmail.com> wrote:
>
> > > I added an SQL insert statement to a button on my web form and when I
> > > debug I get the error: "Incorrect syntax near ','  "  I've been over
> > > and over the code and can't figure out the problem.  Could someone
> > > please take a look at my code and let me know if you see anything
> > > wrong?
>
> > > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > > System.EventArgs) Handles Button1.Click
> > >         Dim oConn As New
> > > System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(­­"CMSConnectionString").ConnectionString)
> > >         Dim cmd As New System.Data.SqlClient.SqlCommand()
> > >         cmd.Connection = oConn
> > >         oConn.Open()
> > >         cmd.CommandText = "INSERT into
> > > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > > INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> > > DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> > > & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> > > "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> > > DD_OthHourType.Text & "')"
> > >         cmd.ExecuteNonQuery()
> > >         oConn.Close()
>
> > >     End Sub- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: Debugging error with insert statement

I've been looking for the proper code to use to use parameters in my
insert statement but am not having any luck. Could you suggest a
website for me to get this information? Also, should I be using a
dataset instead of accessing my database directly? I'm not sure of
the guidelines on when you should/shouldn't use a dataset.

On Oct 30, 5:14 pm, Joe Enos <j...@jtenos.com> wrote:
> First of all - classic sql injection attack-prone - switch to a
> parametrized command or stored proc.
>
> Second - shouldn't be difficult to debug - just step through it, find
> out what the value of cmd.CommandText is, and dump it into your
> database program - Management Studio or Query Analyzer, etc.  You'll
> probably find a missing single-quote or something like that.
>
> On Oct 30, 3:09 pm, Imstac <imsta...@gmail.com> wrote:
>
>
>
> > I added an SQL insert statement to a button on my web form and when I
> > debug I get the error: "Incorrect syntax near ','  "  I've been over
> > and over the code and can't figure out the problem.  Could someone
> > please take a look at my code and let me know if you see anything
> > wrong?
>
> > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> >         Dim oConn As New
> > System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(­"CMSConnectionString").ConnectionString)
> >         Dim cmd As New System.Data.SqlClient.SqlCommand()
> >         cmd.Connection = oConn
> >         oConn.Open()
> >         cmd.CommandText = "INSERT into
> > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> > DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> > & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> > "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> > DD_OthHourType.Text & "')"
> >         cmd.ExecuteNonQuery()
> >         oConn.Close()
>
> >     End Sub- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: Debugging error with insert statement

On a side note, using dynamic SQL like this is dangerous. Leaves your DB open to SQL injection. Have you considered a parameterized stored procedure? It will help you safe your DB and you will enjoy a performance increase.   It may also help with debugging as the error will most likely tell you you are missing a value. Just my $0.02

 

 



On Fri, Oct 31, 2008 at 10:02 AM, Imstac <imstac73@gmail.com> wrote:

Thank you sooo much!  This was the problem.

On Oct 30, 5:41 pm, "Subrato Mukherjee" <mukherjeesubr...@gmail.com>
wrote:
> I do not think its because of missing single quote but rather a missing
> value itself. I have encountered this kind of problem in which an integer
> value was blank leading to a statement like (.....,'xyz',,...) This causes a
> problem at SQL end. So if you have such empty values coming through, make
> them zero or something similar so no null value is passed
> Hope this helps
>
>
>
> On Thu, Oct 30, 2008 at 6:09 PM, Imstac <imsta...@gmail.com> wrote:
>
> > I added an SQL insert statement to a button on my web form and when I
> > debug I get the error: "Incorrect syntax near ','  "  I've been over
> > and over the code and can't figure out the problem.  Could someone
> > please take a look at my code and let me know if you see anything
> > wrong?
>
> > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> >        Dim oConn As New
>
> > System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(­"CMSConnectionString").ConnectionString)
> >        Dim cmd As New System.Data.SqlClient.SqlCommand()
> >        cmd.Connection = oConn
> >        oConn.Open()
> >        cmd.CommandText = "INSERT into
> > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> > DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> > & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> > "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> > DD_OthHourType.Text & "')"
> >        cmd.ExecuteNonQuery()
> >        oConn.Close()
>
> >    End Sub- Hide quoted text -
>
> - Show quoted text -



--
_______________________________

Take care,
Paul

It is not we non-interventionists who are isolationists. The real isolationists are those who impose sanctions and embargos on countries and peoples across the globe and who choose to use force overseas to promote democracy. A counterproductive approach that actually leads the U.S. to be more resented and more isolated in the world.

Dr. Ron Paul

www.RonPaul2008.com

[DotNetDevelopment] Re: Debugging error with insert statement

Thank you sooo much! This was the problem.

On Oct 30, 5:41 pm, "Subrato Mukherjee" <mukherjeesubr...@gmail.com>
wrote:
> I do not think its because of missing single quote but rather a missing
> value itself. I have encountered this kind of problem in which an integer
> value was blank leading to a statement like (.....,'xyz',,...) This causes a
> problem at SQL end. So if you have such empty values coming through, make
> them zero or something similar so no null value is passed
> Hope this helps
>
>
>
> On Thu, Oct 30, 2008 at 6:09 PM, Imstac <imsta...@gmail.com> wrote:
>
> > I added an SQL insert statement to a button on my web form and when I
> > debug I get the error: "Incorrect syntax near ','  "  I've been over
> > and over the code and can't figure out the problem.  Could someone
> > please take a look at my code and let me know if you see anything
> > wrong?
>
> > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> >        Dim oConn As New
>
> > System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(­"CMSConnectionString").ConnectionString)
> >        Dim cmd As New System.Data.SqlClient.SqlCommand()
> >        cmd.Connection = oConn
> >        oConn.Open()
> >        cmd.CommandText = "INSERT into
> > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> > DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> > & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> > "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> > DD_OthHourType.Text & "')"
> >        cmd.ExecuteNonQuery()
> >        oConn.Close()
>
> >    End Sub- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: How to change the column name in the data set ?

Try This

MyDataset.Tables["TableName"].Columns["OldColumnName"].ColumnName="NewName";

Hope it Helps

[DotNetDevelopment] Re: dot not concurrency question

By the Concurrency It is Meant that More Than one Client Want to
Access the Shared Data, Now Managing there Request is what Concurrency
is, so that both Client/Users get Integrated Data.
I think DotNet provides Concurrency through threads i.e:
System.Threading.Thread and some other Structures Like Mutex, Monitor
and Lock Keywords. I Suggest u to Have Quick Look at
"Visual C#® 2005: How to Program, Second Edition By H. M. Deitel -
Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc."
See Chapter 15 Multithreading, Specially Producer/Consumer With
Synchronization Example
Hope this helps
Dont Hesitate to Write

[DotNetDevelopment] Re: Formating Numbers

Sorry my examples didn;t really match......however how can I format a
number any number to have 2 decimal places....can you give me an
example?

On Oct 31, 4:14 am, Cerebrus <zorg...@sify.com> wrote:
> Have you thought about the fact that 0.0000000345 isn't even nearly
> equivalent to 0.01 ? If you rounded it off, you would get 0.00. If
> that satisfies you, to format strings you can use the fixed format
> specifier("f").
>
> Example:
> 0.0000000345R.ToString("f")
>
> On Oct 31, 8:15 am, cmdolcet69 <colin_dolce...@hotmail.com> wrote:
>
> > Im having a problem with a decalred variable. The variable is declared
> > as a double when I look at the file how its written out it writes out
> > as 0.0000000345 how can I format the number to two decimal places....
> > 0.01

[DotNetDevelopment] Re: How to merge cells in a datagridview control (windows forms application)

I think u should use UniqueConstraint At the time of Loading ur Table
to the DataSet, this might help

Dont Hesitate to Write

[DotNetDevelopment] Re: designer behaves strangely after adding wrapping control into ToolStripControlHost

I also found the simple method below
please refer to these links for more information:
Source:
http://www.msdns.org/archive/1992/posts/199293092.shtml

[DotNetDevelopment] Re: Formating Numbers

Have you thought about the fact that 0.0000000345 isn't even nearly
equivalent to 0.01 ? If you rounded it off, you would get 0.00. If
that satisfies you, to format strings you can use the fixed format
specifier("f").

Example:
0.0000000345R.ToString("f")

On Oct 31, 8:15 am, cmdolcet69 <colin_dolce...@hotmail.com> wrote:
> Im having a problem with a decalred variable. The variable is declared
> as a double when I look at the file how its written out it writes out
> as 0.0000000345 how can I format the number to two decimal places....
> 0.01

[DotNetDevelopment] Re: zero progress

I think the problem lies in the mindset of the programmer. Every
budding programmer, when asked, will readily recite to you the tenets
of OOP. But do they really understand them enough to *use* them ? No,
I don't see it happening at all. Writing performant code requires you
to know about ten different ways of accomplishing the same thing, each
of which is suited to a particular scenario, so that you can decide
which one is best in this case. How many programmers can think of one
method (let alone ten), without having to resort to Google ? Writing
secure code requires you to think pessimistically - "All input is evil
unless proven otherwise.", for instance. How many programmers validate
every single piece of input they receive, as a principle ?

For most programmers, code reusability is being able to copy and paste
the code everywhere with minor modifications, but that's not actually
reusability. The problem is also that procedural programming (as
opposed to Object Oriented) is too easy and doesn't require you to
think about the possibilities beforehand. It allows you to dive right
in and apply the patchwork as you go.

Secondly, the problem is in the education. We stress inordinately upon
the theory of OOP, rather than the implementation. I think OOP is not
something to learn... it is a skill to inculcate. And it takes
sustained effort and strict personal standards. Most IT certification
exams expect a candidate to select a correct option in a multiple
choice format, instead of requiring them to come up with some code.

The problem also lies in the mindset of the Management. Tight delivery
schedules and strained resource availability further reinforce a focus
on getting the job done, not on how it was done or how scalable and
performant it was. If (or rather "When") problems are encountered
later, quickfixes are the best solution to the matter, rather than a
complete redesign to match changed requirements.

You can get an idea of the situation from the fact that most of my
colleagues regard me as eccentric because I am the only one who will
not compromise on the quality of my own or my team's code.

You ask why we're still at the same level as years ago. I think it's
because the creation of software is driven by business considerations
and not the sole pleasure of creating software. The reward is not in
the work itself but in the (material) gains associated with the
completed product. Maybe that's why coders are not artists, but just
labourers.

*rant over* ;-)

On Oct 31, 1:48 am, flatfilehater <lewis...@gmail.com> wrote:
> So I am not the last survivor of the Osborne 'laptop' age!
>
> I am a coding addict - I still get a kick out of having things work
> and seeing others work with it.
>
> the root of my gripe is actually stuff like php and mysql which most
> isp's over here (south africa) use.
>
> when i attacked these things, it was a step backwards (probably many
> steps). it was like dealing with random access  records from flat
> files (but with built in filters and indexing). I thought I had died
> and this was hell.
>
> i am getting into xml (slowly) and am searching for a way to deal
> decently with many to many's.
>
> any ideas out there?
>
> On Oct 21, 8:16 pm, Glenn <ke4ktza...@gmail.com> wrote:
>
>
>
> > Ah, someone else that remembers that era!!
>
> > I guess there are still enough of us out here that still like to write
> > code.  Unfortunately, most of the "code generators" out there don't do a
> > very good job or don't have the ability to generate all the possibilities
> > that we need.  Therefore, we use them to get close and then fill in the
> > blanks with actual coding.
>
> > By doing actual coding I think we can achieve the level of re-use if we code
> > it properly. After a bit of coding, we find that we collect a large enough
> > library that we can start re-using what we have already written.  However,
> > many students out there that frequent this group only accomplish what they
> > can with the code generators (a.k.a., wizards) and don't go beyond that
> > stage.
>
> > I think it will be long after we're out of here that someone will be able to
> > sit down at a computer, tell it what type of program it wants and have the
> > computer create it for them.  However, that only seems to exist in science
> > fiction right now.
>
> > ...Glenn
>
> > On Tue, Oct 21, 2008 at 1:16 PM, flatfilehater <lewis...@gmail.com> wrote:
>
> > > as reply to mails, i am from pre-ms generation.
>
> > > when ms arrived the things had to be ibm compatible - it worked by
> > > creating a relatively common denominator (lowest maybe) for making
> > > mass software feasible (lotus 123 was the spreadsheet of the era but
> > > visicalc was the first; ashton tate's dbase became the database entry
> > > level later).
>
> > > the paradigm shifted with borland turbo pascall - libraries of code
> > > were applied to cut down repetitive coding (i think borland was the
> > > first to use the term window - the mouse arrived with ventura
> > > publishing).
>
> > > this shift was a breath of fresh air and we all said that we were well
> > > on the way to a new generation which would automate even further and
> > > almost interpret things into plain english.
>
> > > now about 25 years on, we are still tick-ticking in code via a babel
> > > of languages - analyse the repetitive nature of the info being sought
> > > in the group and it seems that most are reinventing a wheel.
>
> > > of course i am getting old and cranky but not without reasonable cause
> > > - the very attainable things and logical progress have not happened.
>
> > > time for coffee and a smoke!- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: windows form in thread

Yep, that was the impression I derived from the use of the word
"interactive", too.

On Oct 30, 10:46 pm, Glenn <ke4ktza...@gmail.com> wrote:
> I don't think "interactive" is the right word to what he is trying to do. I
> think he just doesn't want the second dialog to be modal so that the user
> can go back to the first dialog if they want to.
>
> ...Glenn
>
>
>
> On Thu, Oct 30, 2008 at 8:37 AM, 金春鹤 <crane.ji...@gmail.com> wrote:
>
> > On Windows platform, only one form(In windows programming, /form /in c#
> > should be called/ //window/.) can be interactive at a certain moment, so
> > you cannot make more than one forms to be interactive at the same time.
> > If you can find an exception, please tell me :).
> > Anyway, if you want to show a from and start the message loop,
> > /Application.Run(new form1())/ should be used instead of /form.show()/.- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] PDF Problem

Hi

I want to make a online pdf convertor. I have found many solutions but i did not find exact i need.
I have seen a site as a example. My requirements are same as this site is converting the pdf.

https://www.pdfonline.com/convert_pdf.asp

Can any on help.

Jack


[DotNetDevelopment] Formating Numbers

Im having a problem with a decalred variable. The variable is declared
as a double when I look at the file how its written out it writes out
as 0.0000000345 how can I format the number to two decimal places....
0.01

[DotNetDevelopment] Re: Debugging error with insert statement

Thanks Joe, I have seen other code using the parameters and wasn't
sure what the best method was to use. I will switch to the parameter
method. I will try your suggestion on the syntax error.

On Oct 30, 5:14 pm, Joe Enos <j...@jtenos.com> wrote:
> First of all - classic sql injection attack-prone - switch to a
> parametrized command or stored proc.
>
> Second - shouldn't be difficult to debug - just step through it, find
> out what the value of cmd.CommandText is, and dump it into your
> database program - Management Studio or Query Analyzer, etc.  You'll
> probably find a missing single-quote or something like that.
>
> On Oct 30, 3:09 pm, Imstac <imsta...@gmail.com> wrote:
>
>
>
> > I added an SQL insert statement to a button on my web form and when I
> > debug I get the error: "Incorrect syntax near ','  "  I've been over
> > and over the code and can't figure out the problem.  Could someone
> > please take a look at my code and let me know if you see anything
> > wrong?
>
> > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> >         Dim oConn As New
> > System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings(­"CMSConnectionString").ConnectionString)
> >         Dim cmd As New System.Data.SqlClient.SqlCommand()
> >         cmd.Connection = oConn
> >         oConn.Open()
> >         cmd.CommandText = "INSERT into
> > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> > DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> > & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> > "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> > DD_OthHourType.Text & "')"
> >         cmd.ExecuteNonQuery()
> >         oConn.Close()
>
> >     End Sub- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: Debugging error with insert statement

I do not think its because of missing single quote but rather a missing value itself. I have encountered this kind of problem in which an integer value was blank leading to a statement like (.....,'xyz',,...) This causes a problem at SQL end. So if you have such empty values coming through, make them zero or something similar so no null value is passed

Hope this helps

On Thu, Oct 30, 2008 at 6:09 PM, Imstac <imstac73@gmail.com> wrote:

I added an SQL insert statement to a button on my web form and when I
debug I get the error: "Incorrect syntax near ','  "  I've been over
and over the code and can't figure out the problem.  Could someone
please take a look at my code and let me know if you see anything
wrong?

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
       Dim oConn As New
System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("CMSConnectionString").ConnectionString)
       Dim cmd As New System.Data.SqlClient.SqlCommand()
       cmd.Connection = oConn
       oConn.Open()
       cmd.CommandText = "INSERT into
Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
& ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
"'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
DD_OthHourType.Text & "')"
       cmd.ExecuteNonQuery()
       oConn.Close()


   End Sub

[DotNetDevelopment] Re: Debugging error with insert statement

First of all - classic sql injection attack-prone - switch to a
parametrized command or stored proc.

Second - shouldn't be difficult to debug - just step through it, find
out what the value of cmd.CommandText is, and dump it into your
database program - Management Studio or Query Analyzer, etc. You'll
probably find a missing single-quote or something like that.

On Oct 30, 3:09 pm, Imstac <imsta...@gmail.com> wrote:
> I added an SQL insert statement to a button on my web form and when I
> debug I get the error: "Incorrect syntax near ','  "  I've been over
> and over the code and can't figure out the problem.  Could someone
> please take a look at my code and let me know if you see anything
> wrong?
>
> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>         Dim oConn As New
> System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("CMSConnectionString").ConnectionString)
>         Dim cmd As New System.Data.SqlClient.SqlCommand()
>         cmd.Connection = oConn
>         oConn.Open()
>         cmd.CommandText = "INSERT into
> Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
> DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
> & ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
> "'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
> DD_OthHourType.Text & "')"
>         cmd.ExecuteNonQuery()
>         oConn.Close()
>
>     End Sub

[DotNetDevelopment] Debugging error with insert statement

I added an SQL insert statement to a button on my web form and when I
debug I get the error: "Incorrect syntax near ',' " I've been over
and over the code and can't figure out the problem. Could someone
please take a look at my code and let me know if you see anything
wrong?

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oConn As New
System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("CMSConnectionString").ConnectionString)
Dim cmd As New System.Data.SqlClient.SqlCommand()
cmd.Connection = oConn
oConn.Open()
cmd.CommandText = "INSERT into
Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
& ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
"'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
DD_OthHourType.Text & "')"
cmd.ExecuteNonQuery()
oConn.Close()


End Sub

[DotNetDevelopment] Re: zero progress

So I am not the last survivor of the Osborne 'laptop' age!

I am a coding addict - I still get a kick out of having things work
and seeing others work with it.

the root of my gripe is actually stuff like php and mysql which most
isp's over here (south africa) use.

when i attacked these things, it was a step backwards (probably many
steps). it was like dealing with random access records from flat
files (but with built in filters and indexing). I thought I had died
and this was hell.

i am getting into xml (slowly) and am searching for a way to deal
decently with many to many's.

any ideas out there?


On Oct 21, 8:16 pm, Glenn <ke4ktza...@gmail.com> wrote:
> Ah, someone else that remembers that era!!
>
> I guess there are still enough of us out here that still like to write
> code.  Unfortunately, most of the "code generators" out there don't do a
> very good job or don't have the ability to generate all the possibilities
> that we need.  Therefore, we use them to get close and then fill in the
> blanks with actual coding.
>
> By doing actual coding I think we can achieve the level of re-use if we code
> it properly. After a bit of coding, we find that we collect a large enough
> library that we can start re-using what we have already written.  However,
> many students out there that frequent this group only accomplish what they
> can with the code generators (a.k.a., wizards) and don't go beyond that
> stage.
>
> I think it will be long after we're out of here that someone will be able to
> sit down at a computer, tell it what type of program it wants and have the
> computer create it for them.  However, that only seems to exist in science
> fiction right now.
>
> ...Glenn
>
> On Tue, Oct 21, 2008 at 1:16 PM, flatfilehater <lewis...@gmail.com> wrote:
>
> > as reply to mails, i am from pre-ms generation.
>
> > when ms arrived the things had to be ibm compatible - it worked by
> > creating a relatively common denominator (lowest maybe) for making
> > mass software feasible (lotus 123 was the spreadsheet of the era but
> > visicalc was the first; ashton tate's dbase became the database entry
> > level later).
>
> > the paradigm shifted with borland turbo pascall - libraries of code
> > were applied to cut down repetitive coding (i think borland was the
> > first to use the term window - the mouse arrived with ventura
> > publishing).
>
> > this shift was a breath of fresh air and we all said that we were well
> > on the way to a new generation which would automate even further and
> > almost interpret things into plain english.
>
> > now about 25 years on, we are still tick-ticking in code via a babel
> > of languages - analyse the repetitive nature of the info being sought
> > in the group and it seems that most are reinventing a wheel.
>
> > of course i am getting old and cranky but not without reasonable cause
> > - the very attainable things and logical progress have not happened.
>
> > time for coffee and a smoke!

Thursday, October 30, 2008

[DotNetDevelopment] Re: WCF Duplex with return values

Don't you hate it when that happens?!?!?!
 
Can you call your server in a background thread?  Then your callback can simply use delegates to update the UI.
 
...Glenn

On Thu, Oct 30, 2008 at 8:41 AM, mr.tim.long <tim@tourismradio.co.za> wrote:

Turns out the problem wasn't the duplex communication after all.
My callback was trying to write to the UI, but that thread was being
used call the server, so it was blocking there.

I solved the problem by decorating the callback class with
[CallbackBehaviour(UseSynchronizationContext=false)] and writing to
the UI differently.

Thanks anyway,
Tim

[DotNetDevelopment] Re: windows form in thread

I don't think "interactive" is the right word to what he is trying to do.  I think he just doesn't want the second dialog to be modal so that the user can go back to the first dialog if they want to.
 
...Glenn

On Thu, Oct 30, 2008 at 8:37 AM, 金春鹤 <crane.jin.l@gmail.com> wrote:

On Windows platform, only one form(In windows programming, /form /in c#
should be called/ //window/.) can be interactive at a certain moment, so
you cannot make more than one forms to be interactive at the same time.
If you can find an exception, please tell me :).
Anyway, if you want to show a from and start the message loop,
/Application.Run(new form1())/ should be used instead of /form.show()/.

[DotNetDevelopment] Re: windows form in thread

You don't need to run fob.Show() in a separate thread.  It can run in the same thread as the main window.  You can, however, update the window/dialog from another thread by using delegates.
 
...Glenn

On Wed, Oct 29, 2008 at 6:25 AM, asit <lipun4u@gmail.com> wrote:

I have created a windows form in side another form. I have also
created a thread and want to run the 2nd form from first one so that
at anytme both the forms are ineractive.

the code is

ArrayList  al = new ArrayList( );
.......
......

Form2 fob = new Form2( );
Thread thd = new Thread(fob.Show );
al.add(thd);
thd.Start( );

In the above code al is the placeholders of all the threads(windows
forms).

But when I run the program, the 2nd form appeared only for momentarily
and disappeared.

Please help me.

[DotNetDevelopment] Need help with some LinQ oddities in c#

I recently discovered that LINQ isn't as versatile as I had hoped and
I hope someone can shed a light on why and maybe provide some
suggestions for workarounds.

The jist of it is I have a datatable with 2 columns, first column is
"Key0" and the second column is "Value". Inside the table is full of
legit data all decimal values in the Key0 field (0.00, 13.00,
etc...). However, that column's datatype in the datatable is actually
a string (Which is a point of confusion as the field in the database
that this datatable is being filled with is a decimal(8,2)).

The first problem is that LINQ seems to try and be too smart when
using the DataTable.select method and tries to predict how to convert
the value in the select statement. For example, if I do
tbl.Select("Key0 = 0") I receive the following exception:

Exception occured: Cannot perform '=' operation on System.String and
System.Int32.
at System.Data.BinaryNode.SetTypeMismatchError(Int32 op, Type left,
Type right)
at System.Data.BinaryNode.BinaryCompare(Object vLeft, Object
vRight, StorageType resultType, Int32 op)
at System.Data.Select.Eval(BinaryNode expr, DataRow row,
DataRowVersion version)
at System.Data.Select.Evaluate(Int32 record)
at System.Data.Select.FindFirstMatchingRecord()
at System.Data.Select.GetBinaryFilteredRecords()
at System.Data.Select.SelectRows()
at System.Data.DataTable.Select(String filterExpression)
at <My Code line calling the datatable.select() statement>

However tbl.Select("Key0 = 0.0") works (note: I did 0.0 even though
the string value is 0.00) and the correct row is returned. Does this
make any sense?

So as a bandaid I changed my query to cast that field as an int in my
SQL query (so now the value is 0 instead of 0.00 in the data table).
Now (My second problem) tbl.Select("Key0 = 0") works correctly,
however now other oddities are popping up. If I do tbl.Select("Key0 =
13") no values are returned even though tbl[13]["Key0"] == 13 (seen
through the debugger). if I instead do tbl.Select("Key0 = '13'") that
does return the correct row, however that restricts me in selecting
numerical data. This isn't the case for all data (0 works, 22 works,
etc...), most of the rows it can find perfectly fine, however I'm
finding a decent chunk of them that aren't working.

Finally, the last issue is when I do tbl.Select("Key0 = 121") I get
the following System.ArgumentException:

Exception occured: Min (40) must be less than or equal to max (-1) in
a Range object.
at System.Data.Select.GetBinaryFilteredRecords()
at System.Data.Select.SelectRows()
at System.Data.DataTable.Select(String filterExpression)
at <My Code line calling the datatable.select() statement>

Does this make sense to anyone? I don't even know where to look for
this issue.

For reference, the rowcount for the datatable is 425, which is the
exact same number of rows returned by the SQL query. Manually look at
the data shows that the data IS the same from the db results to the
datatable contents. If anyone could shed some light on this I would
be very grateful, as of right now it seems like I'm going to have to
implement my own .Select() type of method, which seems like a horrible
waste of resources.

[DotNetDevelopment] Re: http/1.1 500 Sever Error

How to rectify the error ? I have no idea. (because I have no idea
what is causing the error)

What exactly is the error ? Your web application (is it a web service)
has generated an unhandled exception, and IIS doesn't know what to
serve the client. It adds a generic 500 Http code error and serves it.

How to find out the error ? I might be able to point you in the right
direction : Check the Event Log and any other logs that your
application writes. If possible, debug your application and make sure
all exceptions are flagged (break on all exceptions).


On Oct 30, 6:02 pm, "Jeena Ajiesh" <jeena...@gmail.com> wrote:
> Can anyone tell  me how to rectify this error???
> I cannot open the web application in IIS
>
> Regards
> Jeena

[DotNetDevelopment] Re: http/1.1 500 Sever Error

What type of your application ?

On Thu, Oct 30, 2008 at 8:25 PM, Glenn <ke4ktzarrl@gmail.com> wrote:
http://support.microsoft.com/kb/311766


On Thu, Oct 30, 2008 at 9:02 AM, Jeena Ajiesh <jeenajos@gmail.com> wrote:
Can anyone tell  me how to rectify this error???
I cannot open the web application in IIS

Regards
Jeena


[DotNetDevelopment] Re: http/1.1 500 Sever Error

http://support.microsoft.com/kb/311766

On Thu, Oct 30, 2008 at 9:02 AM, Jeena Ajiesh <jeenajos@gmail.com> wrote:
Can anyone tell  me how to rectify this error???
I cannot open the web application in IIS

Regards
Jeena

[DotNetDevelopment] Re: Secure web service methods to few users!

Try turning on security for the service's connection.  Delicious implements security through an https connection, which is what they use for all their services.  Implementing something along that lines should achieve what you want.
 
...Glenn

On Wed, Oct 29, 2008 at 7:38 PM, Venky <fromvenky@gmail.com> wrote:

Hi,

How can I secure my Web Service from caller calling it?

Let say I've a web service facing external customers (ie on Internet)
- I want my web method can call by only few peoples not by everyone?

I know its kind of open ended question - any idea highly appreciate

Regards
Venky

[DotNetDevelopment] Re: Secure web service methods to few users!

It is really depending on 'how secure' you want to be. You can open
your firewall for only the IP addresses of the clients, or you can add
windows authentication to your website. It is also possible to work
with certificates. Or work with a VPN. You can also add the security
into your webservice it self.

--
peter

On Thu, Oct 30, 2008 at 12:38 AM, Venky <fromvenky@gmail.com> wrote:
>
> Hi,
>
> How can I secure my Web Service from caller calling it?
>
> Let say I've a web service facing external customers (ie on Internet)
> - I want my web method can call by only few peoples not by everyone?
>
> I know its kind of open ended question - any idea highly appreciate
>
> Regards
> Venky
>

[DotNetDevelopment] Re: Read image from scanner

And.....where's your help?
 
This topic has been asked many times in this group and the basic information is widely available.  There is a really neat search tool to find it: Google. 
 
...Glenn

On Wed, Oct 29, 2008 at 3:07 PM, Jayaram Krishnswamy <mysorian@gmail.com> wrote:

The guy is asking for help. You crack a joke!

[DotNetDevelopment] Re: Read image from scanner

There was one thing missing from his post: "Snd me cud plz."
 
...Glenn

On Wed, Oct 29, 2008 at 10:17 AM, Cerebrus <zorg007@sify.com> wrote:

Ah, common problem. Your application needs new spectacles. They get
myopic every once in a while !

On Oct 29, 3:37 pm, k1 <ozzyfat2...@gmail.com> wrote:
> Hi ,all
> how can i read image from scanner to my app.
> thx

[DotNetDevelopment] Re: Read image from scanner

 
Of course, that's assuming that you're using .NET, which is what this group is about.
 
...Glenn

On Wed, Oct 29, 2008 at 6:37 AM, k1 <ozzyfat2000@gmail.com> wrote:

Hi ,all
how can i read image from scanner to my app.
thx

[DotNetDevelopment] http/1.1 500 Sever Error

Can anyone tell  me how to rectify this error???
I cannot open the web application in IIS

Regards
Jeena

[DotNetDevelopment] Re: WCF Duplex with return values

Turns out the problem wasn't the duplex communication after all.
My callback was trying to write to the UI, but that thread was being
used call the server, so it was blocking there.

I solved the problem by decorating the callback class with
[CallbackBehaviour(UseSynchronizationContext=false)] and writing to
the UI differently.

Thanks anyway,
Tim

On Oct 30, 11:37 am, "mr.tim.long" <t...@tourismradio.co.za> wrote:
> Hi,
>
> This issue has been driving me a little crazy.
>
> I've setup a wcf service with duplex communication and it works well
> for one way functions. i.e. my contract looks a bit like this
>
> [ServiceContract(SessionMode=SessionMode.Required,
> CallbackContract=typeof(ILogMessaging)]
> public interface IMyContract
> {
>    [OperationContract(IsOneWay=true)]
>    void DoSomething();
>
> }
>
> The implementation of DoSomething() invokes the callback of
> effectively sends back a log message to the client, and it all works
> nicely, the message appears at the client.
>
> The problem is when I want to put in a function that returns a value
> and uses the callback. So, for example:
>
>    [OperationContract]
>    DateTime WhatIsTheTime();
>
> with implementation:
> DateTime WhatIsTheTime()
> {
>    Callback.LogMessage("you asked for the time");
>    return DateTime.Now;
>
> }
>
> The client ends up timing out, and throws a timeoutexception. I've
> read that because the service is single-threaded you get a deadlock
> situation where client and server are both waiting for each other to
> finish, so I guess this is what is causing the timeout. The solution
> they say is to set the concurrency behaviour to Reentrant or Multiple.
>
> But I don't understand this. I've set my callback function to
> IsOneWay=True, and besides, when debugging I can see that execution
> moves past the Callback statement. So I don't know what the client is
> waiting for. I've tried changing the concurrency behaviour to
> Reentrant or Multiple, but that didn't make any difference (was i
> doing it wrong?)
>
> Is there a way around this, or is it not possible to have this type of
> behaviour? Am I trying to have my cake and eat it?
>
> Thanks for your help,
> Tim

[DotNetDevelopment] Re: windows form in thread

On Windows platform, only one form(In windows programming, /form /in c#
should be called/ //window/.) can be interactive at a certain moment, so
you cannot make more than one forms to be interactive at the same time.
If you can find an exception, please tell me :).
Anyway, if you want to show a from and start the message loop,
/Application.Run(new form1())/ should be used instead of /form.show()/.

> I have created a windows form in side another form. I have also
> created a thread and want to run the 2nd form from first one so that
> at anytme both the forms are ineractive.
>
> the code is
>
> ArrayList al = new ArrayList( );
> .......
> ......
>
> Form2 fob = new Form2( );
> Thread thd = new Thread(fob.Show );
> al.add(thd);
> thd.Start( );
>
> In the above code al is the placeholders of all the threads(windows
> forms).
>
> But when I run the program, the 2nd form appeared only for momentarily
> and disappeared.
>
> Please help me.
>
>

[DotNetDevelopment] File uploading problem

hi dear all
me doing file uploading application using asp.net2.0.i am trying to
upload the file to database.its working fine in local system.and when
i checked in server its asking that.select file to upload.
here is my code please help me to do the same

protected void Button1_Click(object sender, EventArgs e)
{
FileInfo imageinfo = new FileInfo(File1.Value.Trim());
// Response.Write(imageinfo);


if (!imageinfo.Exists)
this.RegisterStartupScript("alertMsg",
"<script>alert('please Select one file to upload');</script>");
else
{
switch (imageinfo.Extension.ToUpper())
{
case ".PDF": this.UpLoadImageFile(imageinfo); break;
case ".DOC": this.UpLoadImageFile(imageinfo); break;
case ".ZIP": this.UpLoadImageFile(imageinfo); break;
case ".JPG": this.UpLoadImageFile(imageinfo); break;
case ".GIF": this.UpLoadImageFile(imageinfo); break;
case ".BMP": this.UpLoadImageFile(imageinfo); break;
default: this.RegisterClientScriptBlock("alertMsg",
"<script>alert('file type error.');</script>"); break;


}
}
}


private void UpLoadImageFile(FileInfo info)
{
SqlConnection ObjConn = null;
SqlCommand ObjCom = null;


try
{
byte[] content = new byte[info.Length];
FileStream imagestream = info.OpenRead();
imagestream.Read(content, 0, content.Length);
imagestream.Close();


ObjConn = new
SqlConnection(ConfigurationManager.AppSettings["jayanti"]);
ObjCom = new SqlCommand("Insert
jayanti_file(Description,Filename,Picture,Type)
values(@Description,@Filename,@Picture,@type)", ObjConn);
ObjCom.Parameters.Add("@Filename",
SqlDbType.NVarChar).Value =
System.IO.Path.GetFileName(File1.PostedFile.FileName);
ObjCom.Parameters.Add("@type", SqlDbType.NVarChar).Value
=
System.IO.Path.GetFileName(File1.PostedFile.ContentType);


ObjCom.Parameters.Add("@Description",
SqlDbType.NVarChar).Value = this.TextBox1.Text.Trim();
SqlParameter pictureParameter = new
SqlParameter("@Picture", SqlDbType.Image);
pictureParameter.Value = content;
ObjCom.Parameters.Add(pictureParameter);


ObjConn.Open();
ObjCom.ExecuteNonQuery();
ObjConn.Close();
Button1.Attributes.Add("OnClick", "javascript: return
confirm('Do you want to Upload File.Confirm?');");


}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
ObjConn.Close();
}
}

[DotNetDevelopment] WCF Duplex with return values

Hi,

This issue has been driving me a little crazy.

I've setup a wcf service with duplex communication and it works well
for one way functions. i.e. my contract looks a bit like this

[ServiceContract(SessionMode=SessionMode.Required,
CallbackContract=typeof(ILogMessaging)]
public interface IMyContract
{
[OperationContract(IsOneWay=true)]
void DoSomething();
}

The implementation of DoSomething() invokes the callback of
effectively sends back a log message to the client, and it all works
nicely, the message appears at the client.

The problem is when I want to put in a function that returns a value
and uses the callback. So, for example:

[OperationContract]
DateTime WhatIsTheTime();

with implementation:
DateTime WhatIsTheTime()
{
Callback.LogMessage("you asked for the time");
return DateTime.Now;
}

The client ends up timing out, and throws a timeoutexception. I've
read that because the service is single-threaded you get a deadlock
situation where client and server are both waiting for each other to
finish, so I guess this is what is causing the timeout. The solution
they say is to set the concurrency behaviour to Reentrant or Multiple.

But I don't understand this. I've set my callback function to
IsOneWay=True, and besides, when debugging I can see that execution
moves past the Callback statement. So I don't know what the client is
waiting for. I've tried changing the concurrency behaviour to
Reentrant or Multiple, but that didn't make any difference (was i
doing it wrong?)

Is there a way around this, or is it not possible to have this type of
behaviour? Am I trying to have my cake and eat it?

Thanks for your help,
Tim

[DotNetDevelopment] Re: convert aspx page to pdf

hi, this is rajesh pola
we hve third party tools to do that

On Thu, Oct 30, 2008 at 8:44 AM, srikanth pola <polasrikan@gmail.com> wrote:

hi

I need to convert my aspx page to pdf on fly. the aspx page consist of dynamic data and some gridview and rotator controls and etc

I hope some one reply me with the c# code
thanks in advance




--


Rajesh Babu. Pola,
Junior Consultant, INC IT&Systems.
Cell: + 91 9966661086  |  Email: rajeshpola@gmail.com |  www.incindia.org

[DotNetDevelopment] Needed Help on Windows DataViewGrid

Hi all,
 
I have a requirement, Where i need to populate the DataViewGrid from the BusinessEntity.
 
Its a Windows Application with C# and .NET 2.0. And the BusinessObject will have One or More Collections and Hierarchical Classes.
 
I have to Show the collections/other classes as Nested Grid or if possible expand/collapse with plus and minus for the details. (Similar to showing TreeView Content in a grid)
 
I need Suggestions on
1) Which DataSource can be used for this Application
2) How to Achieve the Nested Grid in windows application(I am new to Windows Control).
 
Any Help will be appreciated.
 

[DotNetDevelopment] Re: C# webbrowser control making clicking sound

AFAIK, this is a user-specific, browser specific setting.

You can set it off by going to the Control Panel > Sounds and Audio
devices > Sounds tab > 'Windows Explorer' subcategory > 'Start
navigation' item.

On Oct 30, 9:47 am, Vytautas <vytautas.krivic...@gmail.com> wrote:
> Hi,
>
> I have a program which uses a webbrowser control that using a timer
> reloads the contents every so often. Each time it does that it makes a
> clicking sound, as this program is designed to do this at fairly
> regular intervals it can get very annoying.
>
> Does anyone know of any programmatic way to turn that sound off for
> that particular control?
>
> Thank you,
> Vytautas

[DotNetDevelopment] C# webbrowser control making clicking sound

Hi,

I have a program which uses a webbrowser control that using a timer
reloads the contents every so often. Each time it does that it makes a
clicking sound, as this program is designed to do this at fairly
regular intervals it can get very annoying.

Does anyone know of any programmatic way to turn that sound off for
that particular control?

Thank you,
Vytautas

[DotNetDevelopment] Re: Refresh ASP.net/VB page on button click.

using javaScript: at onclick event of button
document.formname.reload(true);

or

if page is in iframe
document.iframename.location = document.iframename.location

Response.Redirect("mypage.aspx") might put some overhead on webserver.

Thanks,
Kuldeep.

On Tue, Oct 28, 2008 at 11:40 PM, Brent <revidium@gmail.com> wrote:

I've been looking all over for a way to simply refresh a page using a
button control.  Please help.

[DotNetDevelopment] convert aspx page to pdf


hi

I need to convert my aspx page to pdf on fly. the aspx page consist of dynamic data and some gridview and rotator controls and etc

I hope some one reply me with the c# code
thanks in advance

[DotNetDevelopment] Re: CMS solutions

Have a look at Loudclick Site builder / CMS at http://www.loudclick.net
i found that very good.

On Oct 25, 1:16 pm, FarshadBinNasoordeen <fara...@gmail.com> wrote:
> thatz sounds grate thanks!!!

[DotNetDevelopment] Re: Clearing DataGridView without Losing DefaultCellStyle

look at this... might help!

http://bytes.com/forum/post2456542-1.html


On Oct 29, 4:30 pm, Adam <adam.cheese...@gmail.com> wrote:
> I am clearing a DataGridView (DataSource = null)
>
> but it is also clearing the Default Cell Style and then the next time
> i bind the datasource the column widths are wrong, the text isn't
> wrapped or centered and the column headers titles are database table
> column names.
>
> please help
> (windows forms application - C# - Visual Studio 2005)

[DotNetDevelopment] Re: multiple projects in single solution, help

Glenn, calm down.  It is OK.  :-)

As you said this IS a .Net group.

However .Net isn't just C# or VB, there is also C++ (and plenty of other now).

And, wow, C++ has, .... HEADER FILES!

Anyway, enough of that.  See Header files?  I do.



On Tue, Oct 28, 2008 at 1:49 PM, Glenn <ke4ktzarrl@gmail.com> wrote:
When you are referring to header files, you are NOT dealing with .NET.  You will notice by the title of this group that it is a .NET-specific group.  Asking questions in the wrong group can yield undesired answers.  As a general rule, you should ALWAYS state your environment when you ask your question.  This includes the IDE version and language.
 
For projects that are not .NET, you need to include the header and library files in order to use the data across projects.  The library file is simply a reference to what is contained within the dll that you are creating for your project.  You'll find the library file in the same directory as the dll.
 
If you were using .NET, you would simply reference the first project in the second projects settings.  No header or library files needed.
 
...Glenn

On Tue, Oct 28, 2008 at 1:11 PM, karolpal.jr@gmail.com <karolpal.jr@gmail.com> wrote:

i'm sorry i probably didn't make myself clear the first time. The
thing is that i have two projects open under one sollution and i'm
trying to use some classes in one project that are from the other one.
i don't have a .lib file for the project i only have the headers,
sources and the .obj if i build them.

Does that mean i have to make the .lib file somehow? or just link the
projects in a different way

thanx :)

[DotNetDevelopment] Secure web service methods to few users!

Hi,

How can I secure my Web Service from caller calling it?

Let say I've a web service facing external customers (ie on Internet)
- I want my web method can call by only few peoples not by everyone?

I know its kind of open ended question - any idea highly appreciate

Regards
Venky

[DotNetDevelopment] Clearing DataGridView without Losing DefaultCellStyle

I am clearing a DataGridView (DataSource = null)

but it is also clearing the Default Cell Style and then the next time
i bind the datasource the column widths are wrong, the text isn't
wrapped or centered and the column headers titles are database table
column names.

please help
(windows forms application - C# - Visual Studio 2005)

[DotNetDevelopment] Re: i am a new user ,i have learnt just the basic of C# and SQl sever 2005 and hoping to deploy aplllication very soon .........i need some help or some guidence ....plz can anybody help me out?????

Yaay !! MySoreThroat... I mean -ian to the rescue ! Hic-Hic-Hooray !!

;-)

On Oct 30, 12:09 am, Jayaram Krishnswamy <mysorian@gmail.com> wrote:
> I will help you. Send am email.
>
> mysorian@gmail.com
>
> On Oct 24, 2:32 am, potu <potup...@gmail.com> wrote:
>
>
>
> > i am a new user ,i have learnt just the basic of C# and SQl sever 2005
> > and hoping to deploy aplllication very soon .........i need some help
> > or some guidence ....can u help me out?????- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: Conditional Method

Why don't you try it and let us know, instead ? I don't do much
conditional stuff, but my guess would be : No. What sayest thou ?

Why, you ask ? I'd say it was because the method call would be
compiled to IL only in a Debug build.

On Oct 29, 11:25 pm, oddvark <oddvar...@gmail.com> wrote:
> Hi,
>
> If a method is marked condtional and has a parameter, is the parameter
> not evaluated if the condition is false?
>
> for example (pseudo code):
>
> ===============
> [Conditional : Debug]
>
> public void DebugOut(string message)
> {
>    xxxx
>
> }
>
> xxxx
>
> DebugOut( GetSongName(1) )
>
> ==============
>
> Does GetSongName still get called if Debug is false?
>
> Thanks.

[DotNetDevelopment] Re: Read image from scanner

No, he isn't. Yes, I do.

Silly questions get silly answers. In my experience, people who really
need help *look* like they need help. They know how to ask a question
or atleast make an effort to ask a question.

On Oct 30, 12:07 am, Jayaram Krishnswamy <mysor...@gmail.com> wrote:
> The guy is asking for help. You crack a joke!
>
> On Oct 29, 10:17 am, Cerebrus <zorg...@sify.com> wrote:
>
>
>
> > Ah, common problem. Your application needs new spectacles. They get
> > myopic every once in a while !
>
> > On Oct 29, 3:37 pm, k1 <ozzyfat2...@gmail.com> wrote:
>
> > > Hi ,all
> > > how can i read image from scanner to my app.
> > > thx- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] Re: i am a new user ,i have learnt just the basic of C# and SQl sever 2005 and hoping to deploy aplllication very soon .........i need some help or some guidence ....plz can anybody help me out?????

I will help you. Send am email.

mysorian@gmail.com

On Oct 24, 2:32 am, potu <potup...@gmail.com> wrote:
> i am a new user ,i have learnt just the basic of C# and SQl sever 2005
> and hoping to deploy aplllication very soon .........i need some help
> or some guidence ....can u help me out?????

[DotNetDevelopment] Re: Read image from scanner

The guy is asking for help. You crack a joke!

On Oct 29, 10:17 am, Cerebrus <zorg...@sify.com> wrote:
> Ah, common problem. Your application needs new spectacles. They get
> myopic every once in a while !
>
> On Oct 29, 3:37 pm, k1 <ozzyfat2...@gmail.com> wrote:
>
> > Hi ,all
> > how can i read image from scanner to my app.
> > thx

[DotNetDevelopment] Re: ADO Server issue

check the DNS on the machine that you are having issues connecting with.
Why are you using LMhost files? This is considered "legacy" or an obselete technology.


 
On Wed, Oct 29, 2008 at 11:29 AM, KoldKay <koldkompress@gmail.com> wrote:

Hi all,

I have a problem.  I have several bespoke applications that I have
built and maintain across a small company of 35 people.

I have a user who cannot connect to a SQL Server 2008 using an ADO
Connection, if it uses a host name.  This is specific to the user and
computer.  If the user logs onto another computer, they do not have an
issue and the connection string works fine.  If another user logs onto
their connection, the ADO connection also works fine.

To clarify what I mean by "If it uses a host name", if the connection
string is:
"ODBC;DRIVER=SQL Server;SERVER=SQL1;" (etc) it does not work, but if I
use the IP address of the server, ie, "ODBC;DRIVER=SQL
Server;SERVER=192.168.2.102;" it works.

I have modified the hosts file and lmhosts.sam file to point SQL1 to
the IP Address, and I am able to ping SQL1 to get the IP address.

I can also access this server from the computer.

Any previous experience or help on this would be appreciated

Thank you

Mike

[DotNetDevelopment] Conditional Method

Hi,

If a method is marked condtional and has a parameter, is the parameter
not evaluated if the condition is false?

for example (pseudo code):

===============
[Conditional : Debug]

public void DebugOut(string message)
{
xxxx
}

xxxx

DebugOut( GetSongName(1) )

==============

Does GetSongName still get called if Debug is false?

Thanks.

Wednesday, October 29, 2008

[DotNetDevelopment] Re: Connection String is not initialized error

Funny !!

As must be obvious in hindsight, use
ConfigurationManager.ConnectionStrings instead of AppSettings. ;-)

On Oct 29, 8:52 pm, Imstac <imsta...@gmail.com> wrote:
> I think maybe I'm using the wrong command since my connection is in
> the connection string section.  Here is my web.config file code:
>
> <connectionStrings>
>   <add name="CMSConnectionString" connectionString="Data
> Source=AUSSQL;Initial Catalog=CMS;User ID=timecard;Password=***"
>    providerName="System.Data.SqlClient" />
>   <add name="CMSConnectionString2" connectionString="Data
> Source=AUSSQL;Initial Catalog=CMS;Persist Security Info=True;User
> ID=crd;Password=**"
>    providerName="System.Data.SqlClient" />
>  </connectionStrings>
>
> On Oct 27, 1:58 pm, CK <c...@cksiteoftreats.co.uk> wrote:
>
>
>
> > what you are doing wrong (but its not causing your error) is to use
> > the appSettings section for your connection string.  there is a
> > connectionStrings section just for that :)
>
> > On 24 Oct, 21:29, Imstac <imsta...@gmail.com> wrote:
>
> > > I keep getting a Connection String property is not initialized error
> > > when I run my code and I can't figure out why.  I am using Visual
> > > Basic 2005 and this is a web application.
>
> > > Here is my code:
>
> > > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > > System.EventArgs) Handles Button1.Click
> > >         Dim oConn As New
> > > System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings("CMSCo­­­nnectionString"))
> > >         Dim cmd As New System.Data.SqlClient.SqlCommand()
> > >         cmd.Connection = oConn
> > >         oConn.Open()
> > >         cmd.CommandText = "INSERT into
> > > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > > INOVHR, INOTHR, INOTTY) values('" & EmplID1.Text & "','" &
> > > DatePicker1.DateValue & "','" & DD_DayofWeek.Text & "','" &
> > > DD_jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text & "','"
> > > & RegHrs.Text & "','" & OTHrs.Text & "','" & OthHrs.Text & "','" &
> > > DD_OthHourType.Text & "')"
> > >         cmd.ExecuteNonQuery()
> > >         oConn.Close()
>
> > >     End Sub
>
> > > I checked my connection string code in my web.config file and it looks
> > > fine. Any ideas on what I'm doing wrong.  I'm thinking its my syntax
> > > in my code or something.  This is my first I've attempted this.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

[DotNetDevelopment] ADO Server issue

Hi all,

I have a problem. I have several bespoke applications that I have
built and maintain across a small company of 35 people.

I have a user who cannot connect to a SQL Server 2008 using an ADO
Connection, if it uses a host name. This is specific to the user and
computer. If the user logs onto another computer, they do not have an
issue and the connection string works fine. If another user logs onto
their connection, the ADO connection also works fine.

To clarify what I mean by "If it uses a host name", if the connection
string is:
"ODBC;DRIVER=SQL Server;SERVER=SQL1;" (etc) it does not work, but if I
use the IP address of the server, ie, "ODBC;DRIVER=SQL
Server;SERVER=192.168.2.102;" it works.

I have modified the hosts file and lmhosts.sam file to point SQL1 to
the IP Address, and I am able to ping SQL1 to get the IP address.

I can also access this server from the computer.

Any previous experience or help on this would be appreciated

Thank you

Mike

[DotNetDevelopment] Re: Connection String is not initialized error

I think maybe I'm using the wrong command since my connection is in
the connection string section. Here is my web.config file code:

<connectionStrings>
<add name="CMSConnectionString" connectionString="Data
Source=AUSSQL;Initial Catalog=CMS;User ID=timecard;Password=***"
providerName="System.Data.SqlClient" />
<add name="CMSConnectionString2" connectionString="Data
Source=AUSSQL;Initial Catalog=CMS;Persist Security Info=True;User
ID=crd;Password=**"
providerName="System.Data.SqlClient" />
</connectionStrings>

On Oct 27, 1:58 pm, CK <c...@cksiteoftreats.co.uk> wrote:
> what you are doing wrong (but its not causing your error) is to use
> the appSettings section for your connection string.  there is a
> connectionStrings section just for that :)
>
> On 24 Oct, 21:29, Imstac <imsta...@gmail.com> wrote:
>
>
>
> > I keep getting a Connection String property is not initialized error
> > when I run my code and I can't figure out why.  I am using Visual
> > Basic 2005 and this is a web application.
>
> > Here is my code:
>
> > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> >         Dim oConn As New
> > System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings("CMSCo­­nnectionString"))
> >         Dim cmd As New System.Data.SqlClient.SqlCommand()
> >         cmd.Connection = oConn
> >         oConn.Open()
> >         cmd.CommandText = "INSERT into
> > Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
> > INOVHR, INOTHR, INOTTY) values('" & EmplID1.Text & "','" &
> > DatePicker1.DateValue & "','" & DD_DayofWeek.Text & "','" &
> > DD_jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text & "','"
> > & RegHrs.Text & "','" & OTHrs.Text & "','" & OthHrs.Text & "','" &
> > DD_OthHourType.Text & "')"
> >         cmd.ExecuteNonQuery()
> >         oConn.Close()
>
> >     End Sub
>
> > I checked my connection string code in my web.config file and it looks
> > fine. Any ideas on what I'm doing wrong.  I'm thinking its my syntax
> > in my code or something.  This is my first I've attempted this.- Hide quoted text -
>
> - Show quoted text -