|
dgInv1.DataSource = objRightDataSet.Tables["GetInvGrid"].DefaultView;
it gives me error on the above line, and the ["GetInvGrid"] is not a table but a stored procedure.
I really appreciate your help thanks once again, I have a demo to show and I am stuck
Thanks,
|
|
|
|
|
|
Zindagi11@rediffmail.com wrote:
["GetInvGrid"] is not a table but a stored procedure.
This is your problem then. Did you actually execute that stored procedure? Did it return a table called "GetInvGrid"? If not, this is where your problem is! How do you fix it? Well, that's up to how you wrote your code that fills this table.
The reason you're getting this NullReference error is because you don't have a table in your dataset object that's called "GetInvGrid". Since you don't have that table, you can't get its .DefaultView property!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
well let me see what i can do, as if you just run the procedure alone it returns rows, so let me do it once again
Thanks,
|
|
|
|
|
Yeah, in SQL Analyzer, if you EXEC the procedure, it returns rows. But, apparently, that's not what your coding is doing. From the code you posted, all your doing is trying to get at a table that doesn't exist in the DataSet object. When did you execute this procedure so it could return the rows?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As I said, you have to examine how you populate the data set to find the reason why the table is missing or has a different name.
The actual error is most likely not in the line where you get the error message, but in the code that populates the data set.
---
b { font-weight: normal; }
|
|
|
|
|
i need my application when windows starts my notify icon to load in the Deskbar as any program like norton antivirus or maccfee or even yahoo messenger.
Any help will be appreciated.
Miss With The Best And Die Like The Rest
|
|
|
|
|
Just add a shortcut to your application to the startup folder (C:\Documents and Settings\All Users\Start Menu\Programs\Startup).
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
...or you can make your startup user-safe by adding a new key to the registry and set the value to your application (full path).
Add the key to:
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
create a key like myApp and make the value c:\{path}\myApp.exe
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
hi all.
in my network application i accepted the request of the user to connect to my server by the following code
<br />
Tcplistener server = new TcpListener((Int32)1011));<br />
server.Connect();<br />
while(true)<br />
{<br />
client myclient = new Client(server.AcceptTcpClient());<br />
myclient.Connect();<br />
}<br />
The above code i accept the pending request of the user connection and i have his or her network stream by setting small line of code to initialize property for that
<br />
Public NetworkStream getthisstream<br />
{<br />
get<br />
{<br />
return myclient.Getstream();<br />
}<br />
}<br />
How can i get his or her Ipendpoint by knowing his networkstream to open new udpclient for him to transfer files through the network ? any help about that please
Miss With The Best And Die Like The Rest
|
|
|
|
|
If you're looking for getting the IP address from the TcpClient object, you have to kludge your way through. Something like this.
IPEndPoint GetEndPoint(TcpClient client)
{
Socket socket = (Socket)client.GetType().InvokeMember("Client", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty, null, client, null);
return socket.RemoteEndPoint;
}
The above snippet uses reflection to get the socket instance associated with the TcpClient, because, for some reason, the API designers decided to make it non-public.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Is there a way to convert a string to date type?
Thank you
|
|
|
|
|
|
Hi all!
I've got a big problem with regular expression (I'm not very smart).
I have to select in a text all the c# multiline comments: /* ... */.
I use the following pattern:
\\/\\*.*\\*\\/
Note that I use the SingleLine option, so the dot means ALL chars.
that runs correcly only for the first occurence:
/* hello! */ is ok, but if there are two comments, like:
/* hello 1 */ some text here (with newlines) /* hello 2 */
the pattern selects all the text between the FIRST /* and the LAST */
I know the pattern is wrong, but I do not know any other statement...
Please help!
|
|
|
|
|
Regular expressions are greedy by standard, meaning that the expression .* will try to match as many characters as possible. To make it match as few characters as possible you have to make it non-greedy (lazy) by adding a question mark after it: .*?
Use this pattern:
@"/\*.*?\*/"
---
b { font-weight: normal; }
|
|
|
|
|
|
One big difference I've found between the VB6 RTF and the C# RTF is that the VB6 one has a Print() function. I expected to find an even better one in C#, but there's nothing there. Is there a way to print from a C# RTF short of making my own and basically defeating the whole purpose of having an inbuilt one? I want to be able to specify by page, too, if possible.
|
|
|
|
|
|
That actually worked suprisingly well. Thanks.
|
|
|
|
|
Is there a way to make a property in a propertygrid which opens up a form (sort of like browsing for an image), when a value is chosen from the form and the form closes i then get the chosen value in the property grid ?
|
|
|
|
|
|
Hi,
I am new to Asp.net, I am using the below code on a link-click event to add a row in a datatable and then bind it to a datagrid. But only the last row is visible in the datatable. May be bcoz I am creating a new table on the click. How to get all the values persist on postback???
My code is :
DataTable dt = new DataTable("Requirements");
DataColumn dc= dt.Columns.Add("RequirementId");
DataColumn dc1= dt.Columns.Add("RequirementName");
DataRow row=dt.NewRow();
row["RequirementId"] = "R0001";
row["RequirementName"] = "New Requirement";
dt.Rows.Add(row);
Thanks
dgRequirements.DataSource = new DataView(dt);
dgRequirements.DataBind();
|
|
|
|
|
Set the datagrid's EnableViewState property to true ,and then in the second postback ,access it using :
ViewState["Your DataGrid name"]
And then add the last row only to it.
OR
Create a DataTable object at the class level ,and add its value to the viewstate by the same way,and in the click event just :
DataRow row = myDataTable.NewRow();
row["RequirementId"] = "R0001";
row["RequirementName"] = "New Requirement";
myDataTable.Rows.Add(row);
|
|
|
|
|
hi...
Thx for the reply.
I defined DataTable object at class level.
then I put the below code in form-load
dt=new DataTable();
DataColumn dc= dt.Columns.Add("RequirementId");
DataColumn dc1= dt.Columns.Add("RequirementName");
dgRequirements.DataSource = new DataView(dt); /// datasource to grid
dgRequirements.DataBind();
ViewState["dt"]=dt;
And the Following code at link-click
dt=(DataTable)ViewState["dt"];
DataRow row=dt.NewRow();
row["RequirementId"] = r.RequirementId;
row["RequirementName"] = r.Description;
dt.Rows.Add(row);
ViewState["dt"]=dt;
But its not adding any row in the Datagrid...Whats wrong in the above code?
Thanks a lot.
|
|
|
|
|
You must check first if its a postback or not,
This may work :
Page_load()
{
if(!IsPostBack)
{
dt=new DataTable();
DataColumn dc= dt.Columns.Add("RequirementId");
DataColumn dc1= dt.Columns.Add("RequirementName");
}
else{
DataRow row=dt.NewRow();
row["RequirementId"] = r.RequirementId;
row["RequirementName"] = r.Description;
DataTable t = (DataTable)ViewState["dt"];
t.Rows.Add(row);
ViewState["dt"] = t;
}
}
|
|
|
|