|
|
hello
If my sql statement has multiple lines with comments (i.e. line starting with "//") - how am I going to get it work with Sql cmd and Adapters...? Is there a carriage return escape character ...?
<br />
Cmd = Conn.CreateCommand();<br />
Cmd.CommandType = CommandType.Text;<br />
Cmd.CommandTimeout = 0;<br />
Cmd.CommandText = SomeSQL; << This is multiple lines concatenate to a single string.<br />
ConnFactory = DbProviderFactories.GetFactory("System.Data.SqlClient");<br />
SomeDataSet = new DataSet("MultilineSQL");<br />
SomeTable = new DataTable("MultilineSQL");<br />
SomeDataSet.Tables.Add(SomeTable);<br />
DbAdapter = ConnFactory.CreateDataAdapter();<br />
DbAdapter.SelectCommand = (DbCommand)Cmd;<br />
DbAdapter.Fill(OutputSet, "MultilineSQL");
Thanks
dev
|
|
|
|
|
Are you getting an error while using it now? Could you post a sample of your string query?
|
|
|
|
|
for example
<br />
IF OBJECT_ID('TEMPDB..#SomeTmp) IS NOT NULL DROP TABLE #SomeTmp<br />
CREATE TABLE #SomeTmp<br />
(<br />
a datetime,<br />
b float,<br />
c float,<br />
...<br />
)<br />
// Some comment BLOWS UP HERE <br />
insert into #SomeTmp<br />
exec SomeProc xxxxx
dev
|
|
|
|
|
You probably need some GO 's in there to batch commands up.
IF OBJECT_ID('TEMPDB..#SomeTmp) IS NOT NULL DROP TABLE #SomeTmp
CREATE TABLE #SomeTmp
(
a datetime,
b float,
c float,
...
GO
// insert into #SomeTmp
GO
exec SomeProc xxxxx
GO
|
|
|
|
|
Should the comment be done with -- ?
And when I pass more than one statement in one Command I separate them with semi-colons (; ).
|
|
|
|
|
Hi,
I'm trying to determine if the row has been modified. I have used Visual Studio 2010 and dragged the controls onto the form, so VS has built everything. When a direction button on the navigator is clicked, I run this code.
x = Convert.ToInt32(reunionBindingNavigator.PositionItem.Text);
DataRow dr = KTReunionDataSet.Reunion.Rows[x];
Debug.WriteLine(dr.RowState.ToString());
if (dr.RowState == DataRowState.Modified)
return;
I start with row one, change the date on the calendar, click next, row 2 is now showing, don't modify anything on row 2, click the back button so we are now on Row 1, yet dr.RowState shows as UnModified.
Did I do something wrong or am I missing something?
Thank you,
Glenn
|
|
|
|
|
Hi Glenn,
I have used this code. It will work correctly.
int x = Convert.ToInt32(bindingNavigator1.PositionItem.Text);
DataRow dr = dt.Rows[x-1];
if (dr.RowState == DataRowState.Modified)
{
MessageBox.Show("Modified");
}
I don't know what you have done in second line. Which component(KTReunionDataSet)you are using?.
Thanks,
Gopal.S
Gopal.S
|
|
|
|
|
OKay, so I am writing a server program that connects many clients and sends them out data. The problem is that when a client disconnects, when trying to read from another client I get the error.."Unable to read data from the transport connection: An established connection was aborted by the software in your host machine."
I have the connections saved in a Dictionary
private Dictionary<TcpClient, string> Connections = new Dictionary<TcpClient, string>();
Connections.Add(tcpClient, currUser);
Connections.Remove(tcpUser);
string message = srReceiver.ReadLine();
tcpServer = new TcpClient();
tcpServer.Connect(IPAddress.Parse(ipaddress), port);
swSender = new StreamWriter(tcpServer.GetStream());
swSender.WriteLine("Whatever");
swSender.Flush();
swSender.WriteLine("Close");
swSender.Flush();
swSender.Close();
tcpServer.Close();
|
|
|
|
|
I wanted to add that the dictionary looks fine after the user has been removed.
And this works fine as long as everyone stays connected
|
|
|
|
|
hi all,
i have 3 devlopers work on a web application using visual studio 2005, i want to add this web application to vss (visual source safe), to decrease the problem between them developers.
can help me about how to add this web application to vss??
thanx all.
|
|
|
|
|
This is not really a C# question.
I think you should be consulting the VSS docuementation before proceeding further.
Here is something that can act as a guide to start using VSS.
|
|
|
|
|
hi,
i worked on vss for windows application and its succeeded, but i can not use it for web, i didn't know why its not work successfuly for web.
can u help me?
thank u
|
|
|
|
|
You have already asked this same question, and received many responses.
Continuing to ask the same question will just get you ignored.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes, we've recognized you. From the new wording of your question, I deduce that your 3 developers are working concurrently on a live copy of your website (or maybe even THE live website). (that's why all the stuff we told you yesterday didn't work .
This is the stupidest thing I've ever seen. Vss can't help you in this case. The codeproject can't help you. Your personal god may find it a challenge.
|
|
|
|
|
If you have Visual Source Safe installed, go into File > Source Control and then add the projects to Source Safe there.
"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
i'm working with dataSetDesigner in my app,lately when i create a new tableAdapter, it's select command is null at runTime, but it configure correctly in dataSetDesigner. where is my problem and how to solve it ?
thanks
|
|
|
|
|
Without seeing the code you use to create the new tableAdapter, it is probably impossible to tell.
Post a code fragment - just the relevant bits - and use the "code block" widget to preserve any formatting. Then perhaps we can help...
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in.
Apathy Error: Don't bother striking any key.
|
|
|
|
|
Post what you have done here (some code) and maybe somebody can help you..
|
|
|
|
|
Hi
it's simply creating new tableAdapter object from my tableAdapter class like this :
InstitutionDataSetTableAdapters.BookSalesHeaderTableAdapter adapter = new Institution.InstitutionDataSetTableAdapters.BookSalesHeaderTableAdapter();
|
|
|
|
|
I'm having a problem where an Unmanaged C++ project with a _cdecl calling convention is calling a c# function via COM.
The unmatched calling conventions are raising the following error:
The value of ESP was not properly saved across a function call. This is
usually a result of calling a function declared with one calling
convention with a function pointer declared with a different calling
convention
(In C#) I know that the calling convention can be set on a delegate, but how would I call the delegate through the interface of my c# project? Is delegate usage the wrong approach on the C# side? The unmanaged C++ side cannot be changed, the code must remain unmanaged and with the _cdecl calling convention.
|
|
|
|
|
When managed calls unmanaged, you can choose the calling convention, and specify it at both ends.
When unmanaged calls managed, it is _stdcall, and there is no way to deviate.
See the "two-side logging" example in my article here[^].
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
hi everybody,
I am trying to create a multicolumn listview knowing that it is not possible to do with a listbox
I have 2 questions:
the first is how can i display the header of the columns?
the second is how can i get data from a data base .sdf and display it on the colomuns of my listview?
Thank you in advance
|
|
|
|
|
bacem smari wrote: the first is how can i display the header of the columns?
just set the ListView's View to details.
bacem smari wrote: the second is how can i get data from a data base .sdf and display it on the colomuns of my listview?
Well, you could use dataBindings (see here: Data binding a ListView[^] not sure if it will help, but it looks like it might) or you can just populate the Items yourself.
|
|
|
|
|
hi,
thank you but i am trying to fill the listview with the result of a querry.
Can you help me?
|
|
|
|