|
Can anybuddy provide me some good helping material (reading, code etc) for making master detail forms (C# preferably)
|
|
|
|
|
You can get so many examples on net for that if you will use google :
here is the one:
http://msdn2.microsoft.com/en-us/library/c12c1kx4.aspx
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks a lot, I appreciate it. yesterday I worked on the form and its del command is working allright now. I havent worked on updates as yet.
I'm having a little problem in inserting data in the detail table. Its shown in a datagrid and I dont know, the records get inserted automatically thru the grid. Its strange for me. How can we stop this behaviour ir use it more inteligently for our purpose?
Thanks a lot...
|
|
|
|
|
private void MakeReadOnly()
{
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.ReadOnly = true;
}
I think I got the clue here. is that it?
|
|
|
|
|
I had a hard time installing MSDE 2000 onto my system but I eventually did. However, when I check my add remove programs all I see in there is Microsoft SQL CE 2.0 Server Tool but no SQL server. Futhermore everytime I re-start I get a message that states:"The system can not find the file specified". First I am not sure if MSDE was fully installed, since I was getting an error message before. Second: I am not sure how to assign service to application since its computer name appears in there but yet it can nto find service.
1. So my question is how do I assign service to SQL server?
2. How do I know that it is MSDE that is installed?
3. I am getting an error when attempting to start MSSQL Server AD Helper?
Thanks and any information which can help will be greatly appreciated.
Greg
Coding makes the world go round!!!
|
|
|
|
|
1. You shouldn't have to do anything, install should take care of this.
2. from your description, it's not. You should be able to open the services admin tool , and see mssqlserver service. you should be able to start and stop it. There shouldbe a small "server" icon in the system tray (XP). A right click there should get "open Sql Server Manager" as a menu item. from the manager you should be able to start/stop the server, Sql Server agent and DTC.
3. if the server itself is not running, the AD helper can't start.
I would uninstall and try again (what problems did you have installing it - what OS are you installing to?)
|
|
|
|
|
I restarted and before I knew it was up and running fine with service and everything. Thanks
PS: I was using XP.
Greg
Coding makes the world go round!!!
|
|
|
|
|
select SUBSTRING(dmv2_data_text, 40, DATALENGTH(DMV2_DATA_TEXT))
from dmv2 WHERE DMV2_RCD_TYPE = 'R'
When I run this query sometimes there's a carriage return sometimes there isn't. Is there a way to inspect the first char and see if there is a CR and if so shift the whole string over one more space to remove it?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
SELECT CASE WHEN SUBSTRING(dmv2_data_text, 40, 1) = CHAR(13)
THEN SUBSTRING(dmv2_data_text, 42, DATALENGTH(DMV2_DATA_TEXT))
ELSE SUBSTRING(dmv2_data_text, 40, DATALENGTH(DMV2_DATA_TEXT))
END
FROM dmv2 WHERE DMV2_RCD_TYPE = 'R'
If it is a carraige return, then add two (carriage return + line feed).
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
nope still didn't do it. I may have to just live with is and remove it in my code instead of thru SQL.
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
TableName:MyTestTable
ColumnName:TestCol
Two Records:
1='
This<br />
is a test '
2='
This is also<br />
a test '
SELECT '--' + CASE WHEN SUBSTRING(TestCol, 5, 1) = CHAR(13)
THEN SUBSTRING(TestCol, 7, 256)
ELSE SUBSTRING(TestCol, 5, 256)
END
FROM MyTestTable
Result:
--is a test<br />
-- is also<br />
a test<br />
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Okay, I still could not get it to work. So I copied the data from Query Analyzer and pasted into a hex editor and saw that the char before my string is a hex 20...a space. So I tried the query you suggested only make the CHAR(13) to a CHAR(20) and CHAR(32)...still did not work.
Could there be something else there and the system sees and is not reading it right?
Thanks for the help
Tom Wright
tawright915@gmail.com
|
|
|
|
|
I assume you've tried LTRIM()...
Tom Wright wrote: Could there be something else there and the system sees and is not reading it right?
Try this to find out:
select ASCII(SUBSTRING(dmv2_data_text, 40, 1)) AS AsciiCode<br />
from dmv2 WHERE DMV2_RCD_TYPE = 'R'
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
That did it. The correct code was a 10. Strange.
Thanks for the help
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Glad it worked.
FYI:
13 = carriage return<br />
10 = line feed
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Eric, mind if I ask you another question.
I'm calling a SP like this from my code:
myConnection.Open();
SqlCommand myCommand = new SqlCommand("EXEC LA_SP_NYSPINRESPONSE '"+ recType +"', 'P', '"+ Encoding.UTF8.GetString(ByteBuffer, 0, ByteBuffer.Length) +"', " + TrackNumber, myConnection);
myCommand.Connection = myConnection;
myCommand.ExecuteNonQuery();
This works great however on one of repsonses that I'm writing out there is a single quote in the data, thus causing a problem when passing this data to my SP. It thinks it's end quote to a string. Would parameters be better, to pass data that way then to concante it like I'm doing?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
|
I've been trying to learn ADO.NET for a few weeks now. I know most of the components and what they do, but i'm not sure how they all work together. I'm trying to write a very simple app, but I'm not getting it to work. I have 4 tables (Customers, Orders, Products and OrderDetails). There are 3 relationships (Cust to Order, Order to Details and Prod to Details). I set up a windows for with 2 listbox's and a datagrid. I want to be able to populate the first listbox with the customers, click a customer and display their orders in the 2nd listbox. I've got my program this far. Now I want to click on an order and display the the order details (custID, OrderID, ProductID, ProductName, ProductQTY). I've looked online for tutorials and read through a couple of ebooks, but they mostly talk about 1 table or 2 tables max and maybe only 1 relation. Any help would be greatly appreciated.
|
|
|
|
|
Not sure what exactly is confusing you, but the principle is the same as it was for the firs pair of listboxes (you filled the second from orders using the custToOrder relation and the custId of the selected row in the first. Now fill the third from OderDetails using the OderToDetails relation and custId,OrderId from the selected row in the second...).
|
|
|
|
|
Hi all,
My application uses 2 different databases.
so rollback condition here very complex.
example.
1. insert into tableA ---DB1 (points db1)
2. insert into tableA ---DB2 (points db2)
if second qury fails i want to rollback with respective databases.
How can i do that?
|
|
|
|
|
Are you using .NET? If so you can append a transation object to the command for each database and roll back or commit using them. But I think MS has some sort of DTC which I know nothing about.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Look up BEGIN DISTRIBUTED TRANSACTION in SQL Server Books Online.
[edit]See here: clickety[^][/edit]
-- modified at 10:33 Friday 4th August, 2006
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi @all
I was looking around for a solution but i cant find anyone.
The point is, i want to make a list with the Tables inside of a specified mdb file.
Is there a way to read the table structure of an Access mdb?
Greetings
poOkie
|
|
|
|
|
You could take a look at ADOMD, this is a library that can be used to create new access databases or change the structure of existing access databases.
WM.
What about weapons of mass-construction?
|
|
|
|
|
If you are using .Net, the the GetOledbSchemaTable method of the database connection:
static DataTable GetSchemaTable(string connectionString)
{
using (OleDbConnection connection = new
OleDbConnection(connectionString))
{
connection.Open();
DataTable schemaTable = connection.GetOleDbSchemaTable(
OleDbSchemaGuid.Tables,
new object[] { null, null, null, "TABLE" });
return schemaTable;
}
}
If not, then see the ADOMD documentation, it provides a similar function.
|
|
|
|