Solved

asp.net - sample API insert a row into a databasae...

Posted on 2011-03-08
4
372 Views
Last Modified: 2012-05-11
does anyone have a sample API..that will allow a user to insert a row into MS SQL Server DB...in VB.NET...
0
Comment
Question by:GlobaLevel
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
Anil Golamari earned 500 total points
ID: 35073550
some thing similar to this.

<WebMethod()>
 Public Function samplemethod(ByVal searchvalue As String) As string

Dim connStr As String = "Your connection string"       
Dim cmdTxt As String = "Sql query"
Dim myConn As New System.Data.SqlClient.SqlConnection(connStr)
Dim myCmd As New System.Data.SqlClient.SqlCommand(cmdTxt, myConn)
    Try
        myConn.Open()       
        myCmd.ExecuteNonQuery()
      
           Catch ex As Exception
               ' handle exception
           End Try
      
           If myConn.State = Data.ConnectionState.Open
 Then myConn.Close()
            myConn.Dispose()
           myCmd.Dispose()
      
       End Function
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074032
good stuff...one quick question...after inserting the value into the db...the web service then retrieves a .mp3 file and returns it to the client and plays automatically thru a media player...is this possible?  thanks in advance...
0
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 35074060
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 35074168
I just want to understand clearly, Here one you insert some data into sql server then your web service has to retrieve a .mp3 file and return it too client right?

> correct....Im not sure if SQL Server can hold .mp3 files..or if the web server will have to pull it from a file directory off the server and return it to the client...thanks
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now