Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Storing ModuleID, UserID, ItemID in SQL Query?Storing ModuleID, UserID, ItemID in SQL Query?
Previous
 
Next
New Post
11/6/2007 12:30 PM
 



I have a complex SQL query in which I cannot get the ModuleID, UserID & ItemID to store correctly.
The values for the three fields are presently going in as zero:

"INSERT INTO TableName (ModuleID, UserID, ItemID, Field1, Field2)  VALUES ( ' " + Me.ModuleID.ToString() + " ' , ' " + Me.UserID.ToString() + " ' , ' " + Me.ItemID.ToString() + " ' , 1, 2)"

I had a previous thread where I was having the same issue using the controller.vb and stored procedures, but the issue was resolved there.
For whatever reason I cannot get these values to store correct within a standard sql query.
Referring back to the previous posts advice, ModuleID and UserID are stored automatically.
I went back and included the following within the .ascx file  (invisible)(one for each):

<asp:TextBox ID="ModuleIdTextBox" runat="server" Text='<%# Bind("ModuleId") %>' Width="14px" Visible="False">



But still no luck. What do I need to do to store unique ModuleID, UserID & ItemID within SQL Query?


Feedback Appreciated,

-machina12

 
New Post
11/6/2007 5:19 PM
 

Me.ModuleID, Me.UserID., Me.ItemID will only work for pages that inherit from Entities.Modules.PortalModuleBase



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
11/7/2007 9:56 AM
 

 

I am presently Inheriting from Entities.Modules.PortalModuleBase.
But when I tried your recommendation several ways (as listed below), it throws an error to the module.

- VALUES (Me.ModuleID, Me.UserID etc...
- VALUES (ModuleID, UserID etc...
- VALUES (" Me.ModuleID ", " Me.UserID " etc...
- VALUES (" ModuleID ", " UserID " etc...
- VALUES ( ' " + Me.ModuleID + " ', ' " + Me.UserID + " ' etc...
- VALUES ( ' " + ModuleID + " ', ' " + UserID + " ' etc...

What should the VALUES input be to store correctly?

 
New Post
11/7/2007 3:26 PM
 

Perhaps it would help if you showed us more of the code.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
11/7/2007 9:28 PM
 

 

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

Dim myConnection As New SqlConnection("Connection String Here")

myConnection.Open()

Dim myTrans = myConnection.BeginTransaction()

Dim myCommand As New SqlCommand()

myCommand.Connection = myConnection

myCommand.Transaction = myTrans

Try

myCommand.CommandText = "INSERT INTO Calendar (ModuleID, UserID, Field1, Field2, Field3, Field4) VALUES (ModuleId,UserID,1,1,1,1)"

myCommand.ExecuteNonQuery()

myTrans.Commit()

Me.Response.Text = "Records have been written successfully to database."

Catch ep As Exception

myTrans.Rollback()

'Response.Write(ep.ToString())

Me.Response.Text = "No records where written to database."

Finally

myConnection.Close()

End Try

End Sub

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

The 1,1,1 values store fine, but the ModuleID & UserID storing as zero, also in these variations of code:

- VALUES (Me.ModuleID, Me.UserID etc...

- VALUES (ModuleID, UserID etc...

- VALUES (" Me.ModuleID ", " Me.UserID " etc...

- VALUES (" ModuleID ", " UserID " etc...

- VALUES ( ' " + Me.ModuleID + " ', ' " + Me.UserID + " ' etc...

- VALUES ( ' " + ModuleID + " ', ' " + UserID + " ' etc...

.ToString() as well ????
I have also added the texboxes to the .ascx file, as mentioned in the first post. 
They should bind he ModuleId & UserID, and I am not sure if I need them or not.

What should the VALUES input be to store correctly within SQL statement?

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Storing ModuleID, UserID, ItemID in SQL Query?Storing ModuleID, UserID, ItemID in SQL Query?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out