|
Hrrmmm... Also a quite readable question... However, i'll give it a shot...
What do you think about creating a trigger which will add those columns and store the values in a diffrent field??
UPDATE table set field8 = field3 + field4... ... + field8 FROM A, INSERTED B WHERE A.RecordId = B.RecordId
or something quite close to that
abglorie wrote: Note that: some times I want sum from field(4) to field(6) into field(7)
Define 'sometimes' ??
|
|
|
|
|
Good day everybody...
I am facing a problem with ASP.Net when trying to update information by clicking Edit on Grid View. I didn’t do anything with the code. I used only the build in functionality of Grid View, but it give me an error which is
"ObjectDataSource 'ODSIPAddress' could not find a non-generic method 'UpdateQuery' that has parameters: OrgCode, Original_OrgCode, original_IPAddress."
Moreover, I create new update statement to do the updating, but also do not work. This is happing only in updating. I don’t know If I am missing some thing or what???
In addition, I tried my query and test it and it is working fine inside, but not in Grid View.
Thanks a lot.
|
|
|
|
|
What's the signature of the method your ObjectDataSource calls on an Update? Parameters?
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
You will have to associate the update command with the method that handles the updated, in this case there are OrgCode, Original_OrgCode, original_IPAddress parameters which i assume a textbox.
Just associate the method at run time
or even you can have the datasource attached with updatecommand in the following manner
UpdateCommand="UPDATE Organisation SET OrgCode= @OrgCode,
Original_OrgCode= @Original_OrgCode, original_IPAddress=@original_IPAddress WHERE someId=@someId"
I have just created an example sql statement you can replace it with the original statement
|
|
|
|
|
Thank you my brothers for your help, but I am new in this field if you could be more clear and here what I have.
In my Grid View I have 3 parameters:
1- IPAddressID (primary key) int not mull (cannot be updated (auto generated)).
2- OrgCode int not null (a dropdownlist that is taken from another table).
3- IPAddress varchar(50) not null (textbox).
Here is the error I am getting:
ObjectDataSource 'ODSIPAddress' could not find a non-generic method 'UpdateQuery' that has parameters: OrgCode, IPAddress, original_IPAddressID, Original_OrgCode, Original_IPAddress.
Here is the query that I am using for updating in the dataobject:
UPDATE DHS_IPAddress
SET OrgCode = @OrgCode, IPAddress = @IPAddress
WHERE (IPAddressID = @Original_IPAddressID) AND (OrgCode = @Original_OrgCode) AND (IPAddress = @Original
|
|
|
|
|
Let me ask you again: what's the signature of your Update method (UpdateQuery)? Post it here because your problem lies in the parameters to this method. One of OrgCode, IPAddress, original_IPAddressID, Original_OrgCode, Original_IPAddress is missing.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
I am using the ASP.Net property (the build in update that comes with the GridView itself). I didn't write any query because when we use the GridView, the update comes with it because it is one of its property.
|
|
|
|
|
I'd thought you use your own ObjectDataSource because the exception message said so.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Then, I tried to use my own ObjectDataSource which refer to the table wanted. I created new update method (which you can choose it from the window that ask you which method you want to do such as DELETE, INSERT UPDATE and etc…) I chose UPDATE to be generated by the system.
Thanks for your help.
|
|
|
|
|
Hi friends
I have one textbox and one button.
I have many html pages in my application.
Now I want to search text from the html pages content.
Suppose I find "category" text and this text is present all Html pages then I want to find out all that html page's title,related url and starting content of this text.
Thanks in advance
Pathan
---------------------------------------------------
|
|
|
|
|
I think that this topic is pretty wide to cover.
I suggest you to give a try "Microsoft Indexing Service"..
OR Google it "Internal Search Engine"[^]
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
This code is for creating subdomain in IIS for example user logs in to any website.
Domain will be created like this username.website.com.
So can any one help me to write this VB code in C#.
Thank you in advance.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
CreateVirtualDir("savan", "sampletest", "D:\Savan\Backup\ChoicesWildNet\Application Sohel")
End Sub
Private Sub CreateVirtualDir(ByVal WebSite As String, ByVal AppName As String, ByVal Path As String)
Dim IISSchema As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/Schema/AppIsolated")
'Dim CanCreate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUpper() = "BOOLEAN"
IISSchema.Dispose()
' If CanCreate Then
Dim PathCreated As Boolean
Try
Dim IISAdmin As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/W3SVC/1/Root")
'make sure folder exists
If Not System.IO.Directory.Exists(Path) Then
System.IO.Directory.CreateDirectory(Path)
PathCreated = True
End If
'If the virtual directory already exists then delete it
For Each VD As System.DirectoryServices.DirectoryEntry In IISAdmin.Children
If VD.Name = AppName Then
IISAdmin.Invoke("Delete", New String() {VD.SchemaClassName, AppName})
IISAdmin.CommitChanges()
Exit For
End If
Next VD
'Create and setup new virtual directory
Dim VDir As System.DirectoryServices.DirectoryEntry = IISAdmin.Children.Add(AppName, "IIsWebVirtualDir")
VDir.Properties("Path").Item(0) = Path
VDir.Properties("AppFriendlyName").Item(0) = AppName
VDir.Properties("EnableDirBrowsing").Item(0) = False
VDir.Properties("AccessRead").Item(0) = True
VDir.Properties("AccessExecute").Item(0) = True
VDir.Properties("AccessWrite").Item(0) = False
VDir.Properties("AccessScript").Item(0) = True
VDir.Properties("AuthNTLM").Item(0) = True
VDir.Properties("EnableDefaultDoc").Item(0) = True
VDir.Properties("DefaultDoc").Item(0) = "default.htm,default.aspx,default.asp"
VDir.Properties("AspEnableParentPaths").Item(0) = True
VDir.CommitChanges()
'the following are acceptable params
'INPROC = 0
'OUTPROC = 1
'POOLED = 2
VDir.Invoke("AppCreate", 1)
Catch Ex As Exception
If PathCreated Then
System.IO.Directory.Delete(Path)
End If
Response.Write(Ex.Message.ToString())
End Try
' End If
End Sub
santosh
|
|
|
|
|
santoshkumarB wrote: So can any one help me to write this VB code in C#.
Sure. What parts of the code is it that you have problems with?
---
single minded; short sighted; long gone;
|
|
|
|
|
thank you,
full because iam not used to vb coding. iam working only with C#.
can u help please..
santosh
|
|
|
|
|
Come on, most of the code is so obvious that you should be able to convert it even without knowing what VB is.
For example:
PathCreated = True
converts to:
PathCreated = true;
and
If VD.Name = AppName Then
converts to:
if (VD.Name == AppName) {
and
VDir.Invoke("AppCreate", 1)
converts to:
VDir.Invoke("AppCreate", 1);
There are a lot of people here who can help you, but noone will do all the work for you if you don't even try for yourself.
---
single minded; short sighted; long gone;
|
|
|
|
|
How much you pay for me ?
SSK.
|
|
|
|
|
C'mon, it's not so different from C#. Just change some of the round brackets to square and add a few more semi-colons...
|
|
|
|
|
|
//TODO: INSTANT C# TODO TASK: Insert the following converted event handlers at the end of the 'InitializeComponent' method for forms, 'Page_Init' for web pages, or into a constructor for other classes:
Button2.Click += new System.EventHandler(Button2_Click);
private void Button2_Click(object sender, System.EventArgs e)
{
CreateVirtualDir("savan", "sampletest", "D:\\Savan\\Backup\\ChoicesWildNet\\Application Sohel");
}
private void CreateVirtualDir(string WebSite, string AppName, string Path)
{
System.DirectoryServices.DirectoryEntry IISSchema = new System.DirectoryServices.DirectoryEntry("IIS://" + WebSite + "/Schema/AppIsolated");
//Dim CanCreate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUpper() = "BOOLEAN"
IISSchema.Dispose();
// If CanCreate Then
bool PathCreated = false;
try
{
System.DirectoryServices.DirectoryEntry IISAdmin = new System.DirectoryServices.DirectoryEntry("IIS://" + WebSite + "/W3SVC/1/Root");
//make sure folder exists
if (! (System.IO.Directory.Exists(Path)))
{
System.IO.Directory.CreateDirectory(Path);
PathCreated = true;
}
//If the virtual directory already exists then delete it
foreach (System.DirectoryServices.DirectoryEntry VD in IISAdmin.Children)
{
if (VD.Name == AppName)
{
IISAdmin.Invoke("Delete", new string[] {VD.SchemaClassName, AppName});
IISAdmin.CommitChanges();
break;
}
}
//Create and setup new virtual directory
System.DirectoryServices.DirectoryEntry VDir = IISAdmin.Children.Add(AppName, "IIsWebVirtualDir");
VDir.Properties["Path"][0] = Path;
VDir.Properties["AppFriendlyName"][0] = AppName;
VDir.Properties["EnableDirBrowsing"][0] = false;
VDir.Properties["AccessRead"][0] = true;
VDir.Properties["AccessExecute"][0] = true;
VDir.Properties["AccessWrite"][0] = false;
VDir.Properties["AccessScript"][0] = true;
VDir.Properties["AuthNTLM"][0] = true;
VDir.Properties["EnableDefaultDoc"][0] = true;
VDir.Properties["DefaultDoc"][0] = "default.htm,default.aspx,default.asp";
VDir.Properties["AspEnableParentPaths"][0] = true;
VDir.CommitChanges();
//the following are acceptable params
//INPROC = 0
//OUTPROC = 1
//POOLED = 2
VDir.Invoke("AppCreate", 1);
}
catch (Exception Ex)
{
if (PathCreated)
{
System.IO.Directory.Delete(Path);
}
Response.Write(Ex.Message.ToString());
}
// End If
}
David Anton
http://www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
C++ to Java Converter: converts C++ to Java
Instant C++: converts C# to C++/CLI and VB to C++/CLI
|
|
|
|
|
|
I am using Response.write to use google maps javascript to put markers on a map, reading latitude and longitude from a SQL Server database. I read the values from the database creating values Lat and Lng and use these in the javascript. However the values of Lat and Lng are not recognised in the javascript. If I hard-code values eg GLatLng(50.953,-4.123) and 1 for userID, a marker is set OK. Can anyone help? I've tried using ClientScript.RegisterClientScriptBlock but got nothing.
<% Dim conn As SqlConnection
conn = New SqlConnection("Data Source=beish2;Initial Catalog=HA4;Integrated Security=True")
conn.Open()
Dim sqlComm As New SqlCommand("SELECT PlaceID,PlaceName, PlaceLat, PlaceLng FROM Places ORDER BY PlaceName", conn)
Dim r As SqlDataReader = sqlComm.ExecuteReader()
While r.Read()
Dim username As String = CStr(r("PlaceName"))
Dim userID As Integer = CInt(r("PlaceID"))
Dim Lat As Double = CDbl(r("PlaceLat"))
Dim Lng As Double = CDbl(r("PlaceLng"))
Response.Write("" & vbCrLf)
Response.Write("//<![CDATA[" & vbCrLf)
Response.Write("map.addControl(new GScaleControl());" & vbCrLf)
Response.Write("var point = new GLatLng(Lat,Lng);" & vbCrLf)
Response.Write("var marker = createMarker(point, userID);" & vbCrLf)
Response.Write("map.addOverlay(marker);" & vbCrLf)
Response.Write("//]]>" & vbCrLf)
Response.Write("" & vbCrLf)
Response.Write(userID)
End While
r.Close()%>
|
|
|
|
|
You can't use VB variables in the Javascript code. They don't exist in the same place, and they don't exist at the same time. Add code to create the variables in the Javascript code. Example:
Response.Write("var Lat = " & Lat.ToString(CultureInfo.InvariantCulture) & ";")
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for reply. Not sure how I get the values from the database (MS SQL Server). Do I need to have the database connection, SQL code and reading of records all within the javascript. If so, do you have any sample code for doing this type of action, or a web site where there are decemt tutorials. I'm not too familiar with javascript
Ken
|
|
|
|
|
beish1 wrote: Thanks for reply. Not sure how I get the values from the database (MS SQL Server).
But you already have code that reads the values from the database. What's wrong with that code?
beish1 wrote: Do I need to have the database connection, SQL code and reading of records all within the javascript.
No, you should absolutely not call the database from the Javascript. It's possible to do so, but that means that anyone can read the database login in the page source.
I showed you how to create a Javascript variable that contains the value from your VB variable. Is there something in that example that you don't understand?
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks for your info - and patience! I wasn't sure what CultureInfo.InvariantCulture
was - do I use that expression everytime for each variable?
Ken
|
|
|
|