Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 sql statement ignored

Author  Topic 

peanutong
Starting Member

3 Posts

Posted - 2008-08-21 : 05:28:10
i am currently using vs 2005 to send mass sms, such that the request goes to SQL server 2005 and then to ozeki sms server.

it was working perfectly fine and it just suddenly stop working.

these are (part of) my codes:

Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
Call SelectAllUsers()
End Sub

Protected Sub SelectAllUsers() 'Method to select all users data to send
Dim connStr As String = ConfigurationManager.ConnectionStrings("SMSConnectionString2").ConnectionString
Dim conn As New SqlConnection(connStr)
conn.Open()


Dim ds As DataSet
Dim mySQL As String = "Select phone_number from users where category = 'A'"
Dim da As SqlDataAdapter

da = New SqlDataAdapter(mySQL, conn)
ds = New DataSet()
da.Fill(ds, "phone_number")

Dim tblNumbers As DataTable

tblNumbers = ds.Tables("phone_number")
Dim drNum As DataRow

For Each drNum In tblNumbers.Rows
InsertSMSRecord(drNum("phone_number").ToString)

Next

Me.textboxError.Visible = True
Me.textboxError.Text = "Message has been sent to all users in Category A."

...

Protected Sub InsertSMSRecord(ByVal recepientNumber As String) 'Inserting Record to Database, To trigger
Dim connStr As String = ConfigurationManager.ConnectionStrings("SMSConnectionString2").ConnectionString
Dim conn As New SqlConnection(connStr)

Dim mySQL As String = "Insert Into ozekimessageout (receiver,msg,timetosend,status,sender,category) values (@receiver,@msg,@timetosend,@status,@sender,@category)"

Dim SqlInsert As SqlCommand = New SqlCommand(mySQL, conn)



SqlInsert.Parameters.AddWithValue("@receiver", recepientNumber)
SqlInsert.Parameters.AddWithValue("@msg", Me.txtMsg.Text)
SqlInsert.Parameters.AddWithValue("@timetosend", Me.showTime.Text)
SqlInsert.Parameters.AddWithValue("@status", "send")
SqlInsert.Parameters.AddWithValue("@sender", Me.lblShowUser.Text)
SqlInsert.Parameters.AddWithValue("@category", Me.dd_category.SelectedValue)

conn.Open()
SqlInsert.ExecuteNonQuery()
conn.Close()

End Sub


nth get sent to the database and when i manually add something into the database, my server doesn't respond as well.

help :(
   

- Advertisement -